mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Merge pull request #1 from e107inc/master
Merge e107inc/e107/master into Mikeygmt/e107
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
---
|
||||
engines:
|
||||
version: "2"
|
||||
plugins:
|
||||
csslint:
|
||||
enabled: false
|
||||
duplication:
|
||||
@@ -36,20 +37,25 @@ engines:
|
||||
config:
|
||||
file_extensions: "php"
|
||||
rulesets: "cleancode,unusedcode,codesize"
|
||||
ratings:
|
||||
paths:
|
||||
- "**.css"
|
||||
- "**.js"
|
||||
- "**.php"
|
||||
exclude_paths:
|
||||
- e107_admin/core_image.php
|
||||
- e107_plugins/log/js/awesomechart.js
|
||||
- e107_docs/**/*
|
||||
- e107_images/**/*
|
||||
- e107_handlers/hybridauth/**/*
|
||||
- e107_handlers/jsshrink/**/*
|
||||
- e107_handlers/phpmailer/**/*
|
||||
- e107_handlers/phpthumb/**/*
|
||||
- e107_handlers/xmlrpc/**/*
|
||||
- e107_web/**/*
|
||||
|
||||
exclude_patterns:
|
||||
- "config/"
|
||||
- "db/"
|
||||
- "dist/"
|
||||
- "features/"
|
||||
- "**/node_modules/"
|
||||
- "script/"
|
||||
- "**/spec/"
|
||||
- "**/test/"
|
||||
- "**/tests/"
|
||||
- "**/vendor/"
|
||||
- "**/*.d.ts"
|
||||
- "e107_admin/core_image.php"
|
||||
- "e107_plugins/log/js/awesomechart.js"
|
||||
- "e107_docs/**/*"
|
||||
- "e107_images/**/*"
|
||||
- "e107_handlers/hybridauth/**/*"
|
||||
- "e107_handlers/jsshrink/**/*"
|
||||
- "e107_handlers/phpmailer/**/*"
|
||||
- "e107_handlers/phpthumb/**/*"
|
||||
- "e107_handlers/xmlrpc/**/*"
|
||||
- "e107_web/**/*"
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,3 +12,5 @@ e107_core/override
|
||||
# Ignore Vim swap files
|
||||
*.swp
|
||||
*.swo
|
||||
e107.htaccess
|
||||
e107InstallLog.log
|
||||
|
@@ -1957,6 +1957,9 @@ function init_session()
|
||||
unset($tz);
|
||||
}
|
||||
|
||||
e107::getDebug()->log("Timezone: ".USERTIMEZONE); // remove later on.
|
||||
|
||||
|
||||
define('USERIP', e107::getIPHandler()->getIP(FALSE));
|
||||
define('POST_REFERER', md5($user->getToken()));
|
||||
|
||||
|
@@ -140,7 +140,12 @@ if(e_AJAX_REQUEST) // TODO improve security
|
||||
$width = ($pid) ? 1 : 0;
|
||||
|
||||
$ret['html'] = "\n<!-- Appended -->\n<li>";
|
||||
$ret['html'] .= e107::getComment()->render_comment($row,'comments','comment',intval($_POST['itemid']),$width);
|
||||
|
||||
/**
|
||||
* Fix for issue e107inc/e107#3154 (Comments not refreshing on submission)
|
||||
* Missing 6th argument ($subject) caused an exception
|
||||
*/
|
||||
$ret['html'] .= e107::getComment()->render_comment($row,'comments','comment',intval($_POST['itemid']),$width, $tp->toDB($clean_subject));
|
||||
$ret['html'] .= "</li>\n<!-- end Appended -->\n";
|
||||
|
||||
$ret['error'] = false;
|
||||
|
@@ -141,7 +141,7 @@ class page_admin_form_ui extends e_admin_form_ui
|
||||
parse_str(str_replace('&', '&', e_QUERY), $query); //FIXME - FIX THIS
|
||||
$query['action'] = 'edit';
|
||||
$query['id'] = $id;
|
||||
$query = http_build_query($query);
|
||||
$query = http_build_query($query,null, '&');
|
||||
|
||||
$text = "<a href='".e_SELF."?{$query}' class='btn btn-default' title='".LAN_EDIT."' data-toggle='tooltip' data-placement='left'>
|
||||
".ADMIN_EDIT_ICON."</a>";
|
||||
|
@@ -367,6 +367,14 @@ echo "</body></html>";
|
||||
// SecretR - EXPERIMENT! SEND CSS data to header. Performance tests in progress.
|
||||
$tmp = array();
|
||||
$e_js = e107::getJs();
|
||||
|
||||
$tmp0 = $e_js->renderJs('library_css', false, 'css', true);
|
||||
if($tmp0)
|
||||
{
|
||||
$tmp['search'][] = '<!-- footer_library_css -->';
|
||||
$tmp['replace'][] = $tmp0;
|
||||
}
|
||||
|
||||
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
|
||||
$tmp1 = $e_js->renderJs('other_css', false, 'css', true);
|
||||
if($tmp1)
|
||||
|
@@ -165,6 +165,7 @@ echo "<title>".(defined("e_PAGETITLE") ? e_PAGETITLE." - " : (defined("PAGE_NAME
|
||||
echo "<!-- *CSS* -->\n";
|
||||
$e_js = e107::getJs();
|
||||
|
||||
|
||||
// Core CSS - XXX awaiting for path changes
|
||||
if (!isset($no_core_css) || !$no_core_css)
|
||||
{
|
||||
@@ -267,9 +268,14 @@ unset($e_headers);
|
||||
|
||||
// ################### RENDER CSS
|
||||
|
||||
echo "\n<!-- Library CSS -->\n";
|
||||
|
||||
$e_js->renderJs('library_css', false, 'css', false);
|
||||
echo "\n<!-- footer_library_css -->\n"; // substituted in footer when detected.
|
||||
|
||||
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
|
||||
$e_js->renderJs('other_css', false, 'css', false);
|
||||
echo "\n<!-- footer_other_css -->\n";
|
||||
echo "\n<!-- footer_other_css -->\n"; // substituted in footer when detected.
|
||||
|
||||
// Core CSS
|
||||
$e_js->renderJs('core_css', false, 'css', false);
|
||||
|
@@ -969,7 +969,7 @@ class plugin_form_ui extends e_admin_form_ui
|
||||
|
||||
if($var['plugin_version'] != $var['plugin_version_file'] && $var['plugin_installflag'])
|
||||
{
|
||||
$text .= "<a class='btn btn-default' href='" . e_SELF . "?mode=".$mode."&action=upgrade&id={$var['plugin_path']}' title=\"" . EPL_UPGRADE . " v" . $var['plugin_version'] . "\" >" . ADMIN_UPGRADEPLUGIN_ICON . "</a>";
|
||||
$text .= "<a class='btn btn-default' href='" . e_SELF . "?mode=".$mode."&action=upgrade&id={$var['plugin_path']}' title=\"" . EPL_UPGRADE . " v" . $var['plugin_version_file'] . "\" >" . ADMIN_UPGRADEPLUGIN_ICON . "</a>";
|
||||
}
|
||||
|
||||
if($var['plugin_installflag'] && e_DEBUG == true)
|
||||
@@ -5122,7 +5122,9 @@ $text .= "
|
||||
";
|
||||
}
|
||||
$text .= "
|
||||
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
|
||||
// 'main/div0' => array('divider'=> true),
|
||||
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P'),
|
||||
|
||||
);
|
||||
|
||||
protected \$adminMenuAliases = array(
|
||||
|
@@ -643,7 +643,7 @@ $text .= "
|
||||
";
|
||||
|
||||
// Date options.
|
||||
$ga = new convert();
|
||||
$ga = e107::getDate();
|
||||
$date1 = $ga->convert_date(time(), "short");
|
||||
$date2 = $ga->convert_date(time(), "long");
|
||||
$date3 = $ga->convert_date(time(), "forum");
|
||||
|
@@ -204,7 +204,15 @@ class upload_ui extends e_admin_ui
|
||||
$this->getModel()->addValidationError(UPLLAN_62);
|
||||
$new_data['upload_active'] = 0;
|
||||
return $new_data;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the upload_category contains only integers
|
||||
// Make sure the owner correspondents to the category id
|
||||
list($catOwner, $catID) = explode("__", $new_data['upload_category'], 2);
|
||||
$new_data['upload_category'] = intval($catID);
|
||||
$new_data['upload_owner'] = $catOwner;
|
||||
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +270,8 @@ class upload_ui extends e_admin_ui
|
||||
return 0;
|
||||
}
|
||||
|
||||
$owner = varset($upload['upload_owner'], 'download');
|
||||
// Make sure the owner is not empty
|
||||
$owner = vartrue($upload['upload_owner'], 'download');
|
||||
|
||||
$uploadObj = e107::getAddon($owner,'e_upload');
|
||||
|
||||
@@ -371,7 +380,9 @@ class upload_form_ui extends e_admin_form_ui
|
||||
|
||||
case 'write':
|
||||
$owner = $this->getController()->getModel()->get('upload_owner');
|
||||
return $value."-- ".$owner; // $this->radio_switch('upload_active', $value, LAN_ACCEPT, LAN_PENDING, $options);
|
||||
//return $value."-- ".$owner; // $this->radio_switch('upload_active', $value, LAN_ACCEPT, LAN_PENDING, $options);
|
||||
// make category editable instead of just displaying data
|
||||
return e107::getForm()->select('upload_category', $opts, $value);
|
||||
break;
|
||||
|
||||
case 'batch':
|
||||
|
@@ -60,7 +60,7 @@ class users_admin extends e_admin_dispatcher
|
||||
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => '0|4'),
|
||||
'main/add' => array('caption'=> LAN_USER_QUICKADD, 'perm' => '4|U0|U1'),
|
||||
'main/prefs' => array('caption'=> LAN_OPTIONS, 'perm' => '4|U2'),
|
||||
'main/ranks' => array('caption'=> LAN_USER_RANKS, 'perm' => '4|U3'),
|
||||
'ranks/list' => array('caption'=> LAN_USER_RANKS, 'perm' => '4|U3'),
|
||||
'main/maintenance' => array('caption'=> LAN_MAINTENANCE, 'perms'=>'4')
|
||||
// 'ranks/list' => array('caption'=> LAN_USER_RANKS, 'perm' => '4|U3')
|
||||
);
|
||||
@@ -86,11 +86,6 @@ class users_admin extends e_admin_dispatcher
|
||||
|
||||
function init()
|
||||
{
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$this->adminMenu['ranks/list'] = array('caption'=> LAN_USER_RANKS. " (experimental)", 'perm' => '4|U3');
|
||||
}
|
||||
|
||||
|
||||
$JS = <<<JS
|
||||
|
||||
@@ -470,7 +465,7 @@ class users_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
public function afterDelete($deletedData,$id=null)
|
||||
public function afterDelete($deletedData, $id=null, $deleted_check)
|
||||
{
|
||||
if(!empty($id))
|
||||
{
|
||||
@@ -2860,10 +2855,10 @@ class users_admin_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
unset($tmp);
|
||||
natsort($imageList);
|
||||
// natsort($imageList);
|
||||
}
|
||||
|
||||
public function afterDelete($data)
|
||||
public function afterDelete($data, $id, $deleted_check)
|
||||
{
|
||||
e107::getCache()->clear_sys('nomd5_user_ranks');
|
||||
}
|
||||
@@ -2938,7 +2933,7 @@ class users_admin_form_ui extends e_admin_form_ui
|
||||
parse_str(str_replace('&', '&', e_QUERY), $query); //FIXME - FIX THIS
|
||||
$query['action'] = 'edit';
|
||||
$query['id'] = $id;
|
||||
$query = http_build_query($query);
|
||||
$query = http_build_query($query, null, '&');
|
||||
|
||||
$text = "<a href='".e_SELF."?{$query}' class='btn btn-default' title='".LAN_EDIT."' data-toggle='tooltip' data-placement='left'>
|
||||
".ADMIN_EDIT_ICON."</a>";
|
||||
|
@@ -2276,7 +2276,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
||||
$get = $_GET;
|
||||
$get['elan'] = $code;
|
||||
|
||||
$qry = http_build_query($get);
|
||||
$qry = http_build_query($get, null, '&');
|
||||
$link = e_REQUEST_SELF.'?'.$qry;
|
||||
}
|
||||
|
||||
|
@@ -1116,7 +1116,7 @@ class news_shortcodes extends e_shortcode
|
||||
{
|
||||
$news_item = $this->news_item;
|
||||
$param = $this->param;
|
||||
$con = new convert;
|
||||
$con = e107::getDate();
|
||||
$news_item['news_start'] = (isset($news_item['news_start']) && $news_item['news_start'] ? str_replace(' - 00:00:00', '', $con->convert_date($news_item['news_start'], 'long')) : LAN_NEWS_19);
|
||||
$news_item['news_end'] = (isset($news_item['news_end']) && $news_item['news_end'] ? ' to '.str_replace(' - 00:00:00', '', $con->convert_date($news_item['news_end'], 'long')) : '');
|
||||
$info = $news_item['news_render_type'] == 1 ? LAN_NEWS_9 : '';
|
||||
|
@@ -554,5 +554,22 @@ class usersettings_shortcodes extends e_shortcode
|
||||
|
||||
}
|
||||
|
||||
function sc_deleteaccountbutton($parm=array())
|
||||
{
|
||||
|
||||
if((int) $_GET['id'] !== USERID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$confirm = defset("LAN_USET_51", "Are you sure? This procedure cannot be reversed! Once completed all personal data that you have entered on this site will be permanently lost and you will no longer be able to login.");
|
||||
$label = defset('LAN_USET_50', "Delete All Account Information");
|
||||
|
||||
$parm['confirm'] = $confirm;
|
||||
|
||||
return e107::getForm()->button('delete_account',1, 'delete', $label, $parm);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -305,7 +305,7 @@ if(deftrue('e_DEVELOPER'))
|
||||
{
|
||||
echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining CSS ======= -->";
|
||||
}
|
||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. .
|
||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library','other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. .
|
||||
|
||||
foreach($CSSORDER as $val)
|
||||
{
|
||||
@@ -374,6 +374,22 @@ $show = deftrue('e_POWEREDBY_DISABLE') ? "none" : "block"; // Let search engines
|
||||
unset($show);
|
||||
echo "\n</body>\n</html>";
|
||||
|
||||
//hook into the end of page (usefull for example for capturing output buffering)
|
||||
//Load e_output.php files.
|
||||
if (!empty($pref['e_output_list']) && is_array($pref['e_output_list']))
|
||||
{
|
||||
foreach($pref['e_output_list'] as $val)
|
||||
{
|
||||
$fname = e_PLUGIN.$val."/e_output.php"; // Do not place inside a function - BC $pref required. .
|
||||
|
||||
if(is_readable($fname))
|
||||
{
|
||||
|
||||
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||
}
|
||||
}
|
||||
unset($ret);
|
||||
}
|
||||
|
||||
//
|
||||
// I Send the buffered page data, along with appropriate headers
|
||||
|
@@ -172,6 +172,7 @@ echo "<title>".(defined('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME
|
||||
// D: Register CSS
|
||||
//
|
||||
$e_js = e107::getJs();
|
||||
|
||||
$e_pref = e107::getConfig('core');
|
||||
|
||||
// Other Meta tags.
|
||||
@@ -315,7 +316,7 @@ else
|
||||
|
||||
|
||||
|
||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme','inline');
|
||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library', 'other','core','plugin','theme','inline');
|
||||
|
||||
|
||||
foreach($CSSORDER as $val)
|
||||
|
@@ -173,6 +173,7 @@ $USERSETTINGS_EDIT = "
|
||||
</table>
|
||||
<div>
|
||||
{UPDATESETTINGSBUTTON}
|
||||
{DELETEACCOUNTBUTTON}
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
@@ -303,6 +304,7 @@ $USERSETTINGS_TEMPLATE['edit'] = "
|
||||
<div class='form-group'>
|
||||
<div class='col-sm-offset-3 col-sm-9'>
|
||||
{UPDATESETTINGSBUTTON}
|
||||
{DELETEACCOUNTBUTTON}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -1479,6 +1479,7 @@ class e_admin_dispatcher
|
||||
$tp = e107::getParser();
|
||||
$var = array();
|
||||
$selected = false;
|
||||
|
||||
foreach($this->adminMenu as $key => $val)
|
||||
{
|
||||
|
||||
@@ -1516,6 +1517,12 @@ class e_admin_dispatcher
|
||||
case 'uri':
|
||||
$k2 = 'link';
|
||||
$v = $tp->replaceConstants($v, 'abs');
|
||||
|
||||
if(!empty($v) && (e_REQUEST_URI === $v))
|
||||
{
|
||||
$selected = $key;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1880,6 +1887,8 @@ class e_admin_controller
|
||||
$data = $_dispatcher->getPageTitles();
|
||||
$search = $this->getMode().'/'.$this->getAction();
|
||||
|
||||
|
||||
|
||||
if(isset($data[$search]))
|
||||
{
|
||||
$res['caption'] = $data[$search];
|
||||
@@ -2152,9 +2161,9 @@ class e_admin_controller
|
||||
return $response;
|
||||
}
|
||||
|
||||
if($action != 'Prefs' && $action != 'Create' && $action !='Edit' && $action != 'List') // Custom Page method in use, so add the title.
|
||||
if($action != 'Prefs' && $action != 'Create' && $action !='Edit' && $action != 'List') // Custom Page method in use, so add the title.
|
||||
{
|
||||
$this->addTitle();
|
||||
$this->addTitle();
|
||||
}
|
||||
|
||||
|
||||
@@ -2164,6 +2173,9 @@ class e_admin_controller
|
||||
{
|
||||
$this->addTitle('#'.$this->getId()); // Inform user of which record is being edited.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ob_start(); //catch any output
|
||||
$ret = $this->{$actionName}();
|
||||
@@ -5478,6 +5490,13 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, false, false, false, $this->listQry))->load();
|
||||
|
||||
$this->addTitle();
|
||||
|
||||
if($this->getQuery('filter_options'))
|
||||
{
|
||||
// var_dump($this);
|
||||
// $this->addTitle("to-do"); // display filter option when active.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6680,7 +6699,7 @@ class e_admin_form_ui extends e_form
|
||||
$vars = $this->getController()->getQuery();
|
||||
$vars['from'] = '[FROM]';
|
||||
|
||||
$paginate = http_build_query($vars);
|
||||
$paginate = http_build_query($vars, null, '&');
|
||||
|
||||
return $this->pagination(e_REQUEST_SELF.'?'.$paginate,$totalRecords,$fromPage,$perPage,array('template'=>'basic'));
|
||||
|
||||
@@ -6744,7 +6763,7 @@ class e_admin_form_ui extends e_form
|
||||
$gridAction = $this->getController()->getAction() === 'grid' ? 'list' : 'grid';
|
||||
$gridQuery = (array) $_GET;
|
||||
$gridQuery['action'] = $gridAction;
|
||||
$toggleUrl = e_REQUEST_SELF."?".http_build_query($gridQuery);
|
||||
$toggleUrl = e_REQUEST_SELF."?".http_build_query($gridQuery, null, '&');
|
||||
$gridIcon = ($gridAction === 'grid') ? ADMIN_GRID_ICON : ADMIN_LIST_ICON;
|
||||
$gridTitle = ($gridAction === 'grid') ? LAN_UI_VIEW_GRID_LABEL : LAN_UI_VIEW_LIST_LABEL;
|
||||
$gridToggle = "<a class='btn btn-default' href='".$toggleUrl."' title=\"".$gridTitle."\">".$gridIcon."</a>";
|
||||
|
@@ -16,7 +16,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php");
|
||||
|
||||
class convert
|
||||
class e_date
|
||||
{
|
||||
|
||||
function __construct()
|
||||
@@ -81,8 +81,7 @@ class convert
|
||||
/**
|
||||
* Return an array of language terms representing months
|
||||
* @param $type string : month, month-short, day, day-short, day-shortest
|
||||
* @return array
|
||||
* TODO Cache!
|
||||
* @return array|bool
|
||||
*/
|
||||
public function terms($type='month')
|
||||
{
|
||||
@@ -173,7 +172,7 @@ class convert
|
||||
break;
|
||||
|
||||
case 'inputtime':
|
||||
$mask .= e107::getPref('inputtime', '%H:%M');
|
||||
$mask = e107::getPref('inputtime', '%H:%M');
|
||||
break;
|
||||
|
||||
case 'forum': // DEPRECATED - temporary here from BC reasons only
|
||||
@@ -225,17 +224,26 @@ class convert
|
||||
return is_numeric($string) ? $this->convert_date($string, $mask) : $this->toTime($string, $mask);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts to new date-mask format or vice-versa when $legacy is TRUE
|
||||
* Converts to new date-mask format or vice-versa when $legacy is TRUE
|
||||
*
|
||||
* string $mask
|
||||
* string|bool $legacy false= strftime > datetimepicker, true = datetimepicker > strftime, 'DateTime' = strftime > DateTime format.
|
||||
* @see https://secure.php.net/manual/en/function.strftime.php
|
||||
* @see https://github.com/AuspeXeu/bootstrap-datetimepicker
|
||||
* @see https://secure.php.net/manual/en/datetime.createfromformat.php
|
||||
*/
|
||||
function toMask($mask, $legacy = false)
|
||||
{
|
||||
//strftime() -> datetimepicker format.
|
||||
$convert = array(
|
||||
'%Y' => 'yyyy', // jquery-ui docs say 'yy' but yy produces '13' instead of '2013'
|
||||
'%d' => 'dd',
|
||||
'%m' => 'mm',
|
||||
'%Y' => 'yyyy', // Year 4-digits '2013'
|
||||
'%d' => 'dd', // day of the month 2-digits
|
||||
'%m' => 'mm', // month number 2-digits
|
||||
'%B' => 'MM', // Full month name, based on the locale
|
||||
'%A' => 'DD', // A full textual representation of the day
|
||||
|
||||
@@ -250,22 +258,58 @@ class convert
|
||||
'%M' => 'ii', // Two digit representation of the minute
|
||||
'%S' => 'ss', // Two digit representation of the second
|
||||
'%P' => 'p', // %P lower-case 'am' or 'pm' based on the given time
|
||||
'%p' => 'P', // %p UPPER-CASE 'AM' or 'PM' based on the given time
|
||||
'%p' => 'P', // %p UPPER-CASE 'AM' or 'PM' based on the given time
|
||||
|
||||
'%T' => 'hh:mm:ss',
|
||||
'%r' => "hh:mmm:ss TT" // 12 hour format
|
||||
);
|
||||
|
||||
|
||||
// strftime() > DateTime::
|
||||
if($legacy === 'DateTime')
|
||||
{
|
||||
$convert = array(
|
||||
'%Y' => 'Y', // Year 4-digits '2013'
|
||||
'%d' => 'd', // Two-digit day of the month (with leading zeros) (01 through 31)
|
||||
'%e' => 'j', // Day of the month, with a space preceding single digits. Not implemented on Windows with strftime.
|
||||
'%m' => 'm', // Two digit representation of the month (01 throught 12)
|
||||
'%B' => 'F', // Full month name, based on the locale
|
||||
'%A' => 'l', // A full textual representation of the day
|
||||
|
||||
'%y' => 'y',
|
||||
'%a' => 'D', // An abbreviated textual representation of the day
|
||||
'%b' => 'M', // Abbreviated month name, based on the locale
|
||||
'%h' => 'M', // Abbreviated month name, based on the locale (an alias of %b)
|
||||
|
||||
'%k' => 'G', // Hour in 24-hour format, with a space preceding single digits (0 through 23)
|
||||
'%I' => 'h', // Two digit representation of the hour in 12-hour format ( 01 through 12)
|
||||
'%l' => 'g', // 12 hour format - no leading zero (1 through 12)
|
||||
'%H' => 'H', // Two digit representation of the hour in 24-hour format (00 through 23)
|
||||
|
||||
'%M' => 'i', // Two digit representation of the minute (00 through 59)
|
||||
'%S' => 's', // Two digit representation of the second (00 through 59)
|
||||
'%P' => 'a', // lower-case 'am' or 'pm' based on the given time
|
||||
'%p' => 'A', // UPPER-CASE 'AM' or 'PM' based on the given time
|
||||
'%Z' => 'e', // The time zone abbreviation. Not implemented as described on Windows with strftime.
|
||||
|
||||
// TODO Add anything that is missing.
|
||||
// '%T' => 'hh:mm:ss',
|
||||
// '%r' => "hh:mmm:ss TT" // 12 hour format
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$s = array_keys($convert);
|
||||
$r = array_values($convert);
|
||||
|
||||
if(strpos($mask, '%') === FALSE && $legacy == TRUE)
|
||||
if(strpos($mask, '%') === false && $legacy === true)
|
||||
{
|
||||
return str_replace($r, $s,$mask);
|
||||
$ret = str_replace($r, $s,$mask);
|
||||
return str_replace('%%p', '%P', $ret); // quick fix.
|
||||
}
|
||||
elseif(strpos($mask,'%')!==FALSE)
|
||||
elseif(strpos($mask,'%')!==false)
|
||||
{
|
||||
return str_replace($s,$r, $mask);
|
||||
return str_replace($s,$r, $mask);
|
||||
|
||||
}
|
||||
|
||||
return $mask;
|
||||
@@ -357,8 +401,24 @@ class convert
|
||||
$mask = e107::getPref('inputtime', '%H:%M');
|
||||
break;
|
||||
}
|
||||
|
||||
// also in php compat handler for plugins that might use it.
|
||||
|
||||
// convert to PHP 5+ @see https://secure.php.net/manual/en/datetime.createfromformat.php
|
||||
$newMask = $this->toMask($mask, 'DateTime');
|
||||
$tdata = date_parse_from_format($newMask, $date_string);
|
||||
|
||||
return mktime(
|
||||
$tdata['hour'],
|
||||
$tdata['minute'],
|
||||
$tdata['second'],
|
||||
$tdata['month'] ,
|
||||
$tdata['day'],
|
||||
$tdata['year']
|
||||
);
|
||||
|
||||
|
||||
// also in php compat handler for plugins that might use it.
|
||||
|
||||
/*
|
||||
$tdata = $this->strptime($date_string, $mask);
|
||||
|
||||
|
||||
@@ -385,14 +445,9 @@ class convert
|
||||
$tdata['tm_mday'],
|
||||
($tdata['tm_year'] + 1900)
|
||||
);
|
||||
|
||||
|
||||
// echo "<br />UNIX=".$unxTimestamp - TIMEOFFSET;
|
||||
// echo "<br />".date("l, d M Y g:i A",$unxTimestamp);
|
||||
|
||||
// var_dump($tdata, $date_string, $this->convert_date($unxTimestamp, $mask), $unxTimestamp);
|
||||
|
||||
return $unxTimestamp;
|
||||
*/
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
@@ -642,24 +697,22 @@ class convert
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This work of Lionel SAURON (http://sauron.lionel.free.fr:80) is licensed under the
|
||||
* Creative Commons Attribution-Noncommercial-Share Alike 2.0 France License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
|
||||
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
||||
*
|
||||
*
|
||||
* http://snipplr.com/view/4964/emulate-php-5-for-backwards-compatibility/
|
||||
*
|
||||
*
|
||||
* Parse a date generated with strftime().
|
||||
*
|
||||
* @author Lionel SAURON and reworked by e107 Inc. for month names.
|
||||
*
|
||||
* @author Lionel SAURON and reworked by e107 Inc. for month names.
|
||||
* @version 1.0
|
||||
* @public
|
||||
*
|
||||
* @param string $str date string to parse (e.g. returned from strftime()).
|
||||
* @param string $sFormat strftime format used to create the date
|
||||
* @param $format
|
||||
* @return array|bool Returns an array with the <code>$str</code> parsed, or <code>false</code> on error.
|
||||
*/
|
||||
public function strptime($str, $format)
|
||||
@@ -787,11 +840,32 @@ class convert
|
||||
|
||||
#-- calculate wday/yday
|
||||
//$vals['tm_mon'] = $vals['tm_mon'] + 1; // returns months from 0 - 11 so we need to +1
|
||||
|
||||
|
||||
|
||||
if (!isset($vals['tm_sec']))
|
||||
{
|
||||
$vals['tm_sec'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($vals['tm_min']))
|
||||
{
|
||||
$vals['tm_min'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($vals['tm_hour']))
|
||||
{
|
||||
$vals['tm_hour'] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($vals['unparsed']))
|
||||
{
|
||||
$vals['unparsed'] = '';
|
||||
}
|
||||
|
||||
$unxTimestamp = mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], ($vals['tm_mon'] + 1), $vals['tm_mday'], ($vals['tm_year'] + 1900));
|
||||
|
||||
$vals['tm_fmon'] = strftime('%B', mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], $vals['tm_mon']));
|
||||
|
||||
$vals['tm_amon'] = strftime('%b', mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], $vals['tm_mon'] + 1));
|
||||
$vals['tm_fmon'] = strftime('%B', mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], $vals['tm_mon'] + 1));
|
||||
$vals['tm_wday'] = (int) strftime('%w', $unxTimestamp); // Days since Sunday (0-6)
|
||||
$vals['tm_yday'] = (strftime('%j', $unxTimestamp) - 1); // Days since January 1 (0-365)
|
||||
|
||||
@@ -919,4 +993,15 @@ class convert
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
/**
|
||||
* BC Fix convert
|
||||
*/
|
||||
class convert extends e_date
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -641,7 +641,10 @@ class db_verify
|
||||
// print_a($data);
|
||||
if($data['type'])
|
||||
{
|
||||
return $data['type']." (".$data['field'].");";
|
||||
//return $data['type']." (".$data['field'].");";
|
||||
// Check if index keyname exists and add backticks
|
||||
$keyname = (!empty($data['keyname']) ? " `".$data['keyname']."`" : "");
|
||||
return $data['type'] . $keyname . " (" . $data['field'] . ");";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -919,9 +922,15 @@ class db_verify
|
||||
function getIndex($data, $print = false)
|
||||
{
|
||||
// $regex = "/(?:(PRIMARY|UNIQUE|FULLTEXT))?[\s]*?KEY (?: ?`?([\w]*)`?)[\s]* ?(?:\([\s]?`?([\w,]*[\s]?)`?\))?,?/i";
|
||||
$regex = "/(?:(PRIMARY|UNIQUE|FULLTEXT|FOREIGN))?[\s]*?KEY (?: ?`?([\w]*)`?)[\s]* ?(?:\([\s]?([\w\s,`]*[\s]?)`?\))?,?/i";
|
||||
// $regex = "/(?:(PRIMARY|UNIQUE|FULLTEXT|FOREIGN))?[\s]*?KEY (?: ?`?([\w]*)`?)[\s]* ?(?:\([\s]?([\w\s,`]*[\s]?)`?\))?,?/i";
|
||||
$regex = "/(?:(PRIMARY|UNIQUE|FULLTEXT|FOREIGN))?[\s]*?(INDEX|KEY) (?: ?`?([\w]*)`?)[\s]* ?(?:\([\s]?([\w\s,`]*[\s]?)`?\))?,?/i";
|
||||
preg_match_all($regex,$data,$m);
|
||||
|
||||
|
||||
if (count($m) > 0)
|
||||
{
|
||||
unset($m[2]);
|
||||
$m = array_combine(range(0, count($m)-1), array_values($m));
|
||||
}
|
||||
$ret = array();
|
||||
|
||||
if($print)
|
||||
@@ -933,6 +942,7 @@ class db_verify
|
||||
|
||||
$fieldReplace = array("`"," ");
|
||||
|
||||
|
||||
foreach($m[3] as $k=>$val)
|
||||
{
|
||||
if(!$val) continue;
|
||||
|
@@ -160,7 +160,8 @@ class e107
|
||||
protected static $_known_handlers = array(
|
||||
'UserHandler' => '{e_HANDLER}user_handler.php',
|
||||
'comment' => '{e_HANDLER}comment_class.php',
|
||||
'convert' => '{e_HANDLER}date_handler.php',
|
||||
'e_date' => '{e_HANDLER}date_handler.php',
|
||||
'convert' => '{e_HANDLER}date_handler.php', // BC Fix.
|
||||
'db' => '{e_HANDLER}mysql_class.php',
|
||||
'e107Email' => '{e_HANDLER}mail.php',
|
||||
'e107_event' => '{e_HANDLER}event_class.php',
|
||||
@@ -1588,7 +1589,7 @@ class e107
|
||||
*/
|
||||
public static function getDateConvert()
|
||||
{
|
||||
return self::getSingleton('convert', true);
|
||||
return self::getSingleton('e_date', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1598,7 +1599,7 @@ class e107
|
||||
*/
|
||||
public static function getDate()
|
||||
{
|
||||
return self::getSingleton('convert', true);
|
||||
return self::getSingleton('e_date', true);
|
||||
}
|
||||
|
||||
|
||||
@@ -2608,7 +2609,7 @@ class e107
|
||||
*/
|
||||
public static function getThemeInfo($for = true, $path = '')
|
||||
{
|
||||
global $user_pref; // FIXME - user model, kill user_pref global
|
||||
// global $user_pref; // FIXME - user model, kill user_pref global
|
||||
|
||||
if(true === $for)
|
||||
{
|
||||
@@ -2628,7 +2629,8 @@ class e107
|
||||
}
|
||||
else
|
||||
{
|
||||
$for = isset($user_pref['sitetheme']) ? $user_pref['sitetheme'] : self::getPref('sitetheme');
|
||||
$user_pref = self::getUser()->getPref();
|
||||
$for = !empty($user_pref['sitetheme']) ? $user_pref['sitetheme'] : self::getPref('sitetheme');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -3788,7 +3790,7 @@ class e107
|
||||
// setup some php options
|
||||
self::ini_set('magic_quotes_runtime', 0);
|
||||
self::ini_set('magic_quotes_sybase', 0);
|
||||
self::ini_set('arg_separator.output', '&');
|
||||
// self::ini_set('arg_separator.output', '&'); // non-standard and bad for third-party script compatibility. @see https://github.com/e107inc/e107/issues/3116
|
||||
self::ini_set('session.use_only_cookies', 1);
|
||||
self::ini_set('session.use_trans_sid', 0);
|
||||
self::ini_set('session.cookie_httponly', 1); // cookie won't be accessible by scripting languages, such as JavaScript. Can effectively help to reduce identity theft through XSS attacks
|
||||
|
@@ -2385,6 +2385,32 @@ class e_parse extends e_parser
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a string to a number (int/float)
|
||||
*
|
||||
* @param string $value
|
||||
* @return int|float
|
||||
*/
|
||||
function toNumber($value)
|
||||
{
|
||||
// adapted from: https://secure.php.net/manual/en/function.floatval.php#114486
|
||||
$dotPos = strrpos($value, '.');
|
||||
$commaPos = strrpos($value, ',');
|
||||
$sep = (($dotPos > $commaPos) && $dotPos) ? $dotPos :
|
||||
((($commaPos > $dotPos) && $commaPos) ? $commaPos : false);
|
||||
|
||||
if (!$sep) {
|
||||
return preg_replace("/[^-0-9]/", "", $value);
|
||||
}
|
||||
|
||||
return (
|
||||
preg_replace("/[^-0-9]/", "", substr($value, 0, $sep)) . '.' .
|
||||
preg_replace("/[^0-9]/", "", substr($value, $sep+1, strlen($value)))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clean and Encode Ampersands '&' for output to browser.
|
||||
* @param string $text
|
||||
@@ -4634,7 +4660,7 @@ class e_parser
|
||||
$ytpref['cc_lang_pref'] = e_LAN; // switch captions with chosen user language.
|
||||
}
|
||||
|
||||
$ytqry = http_build_query($ytpref);
|
||||
$ytqry = http_build_query($ytpref, null, '&');
|
||||
|
||||
$defClass = (deftrue('BOOTSTRAP')) ? "embed-responsive embed-responsive-16by9" : "video-responsive"; // levacy backup.
|
||||
|
||||
|
@@ -820,7 +820,22 @@ class e_form
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a input [type number]
|
||||
*
|
||||
* Additional options:
|
||||
* - decimals: default 0; defines the number of decimals allowed in this field (0 = only integers; 1 = integers & floats with 1 decimal e.g. 4.1, etc.)
|
||||
* - step: default 1; defines the step for the spinner and the max. number of decimals. If decimals is given, step will be ignored
|
||||
* - min: default 0; minimum value allowed
|
||||
* - max: default empty; maximum value allowed
|
||||
* - pattern: default empty; allows to define an complex input pattern
|
||||
*
|
||||
* @param string $name
|
||||
* @param integer $value
|
||||
* @param integer $maxlength
|
||||
* @param array $options decimals, step, min, max, pattern
|
||||
* @return string
|
||||
*/
|
||||
function number($name, $value=0, $maxlength = 200, $options = array())
|
||||
{
|
||||
if(is_string($options)) parse_str($options, $options);
|
||||
@@ -850,17 +865,67 @@ class e_form
|
||||
$options['class'] .= " form-control";
|
||||
$options['type'] ='number';
|
||||
|
||||
$mlength = vartrue($maxlength) ? "maxlength=".$maxlength : "";
|
||||
// Not used anymore
|
||||
//$mlength = vartrue($maxlength) ? "maxlength=".$maxlength : "";
|
||||
|
||||
$min = isset($options['min']) ? 'min="'.$options['min'].'"' : '';
|
||||
$max = isset($options['max']) ? 'max="'.$options['max'].'"' : '';
|
||||
// Always define the min. parameter
|
||||
// defaults to 0
|
||||
// setting the min option to a negative value allows negative inputs
|
||||
$min = " min='".varsettrue($options['min'], '0')."'";
|
||||
$max = isset($options['max']) ? " max='".$options['max']."'" : '';
|
||||
|
||||
if (!empty($options['pattern']))
|
||||
{
|
||||
$pattern = ' pattern="'.trim($options['pattern']).'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$options['pattern'] = '^';
|
||||
// ^\-?[0-9]*\.?[0-9]{0,2}
|
||||
if (varset($options['min'], 0) < 0)
|
||||
{
|
||||
$options['pattern'] .= '\-?';
|
||||
}
|
||||
$options['pattern'] .= '[0-9]*';
|
||||
|
||||
// Integer & Floaat/Double value handling
|
||||
if (isset($options['decimals']))
|
||||
{
|
||||
if (intval($options['decimals']) > 0)
|
||||
{
|
||||
$options['pattern'] .= '\.?[0-9]{0,'.intval($options['decimals']).'}';
|
||||
}
|
||||
|
||||
// defined the step based on number of decimals
|
||||
// 2 = 0.01 > allows integers and float numbers with up to 2 decimals (3.1 = OK; 3.12 = OK; 3.123 = NOK)
|
||||
// 1 = 0.1 > allows integers and float numbers with up to 2 decimals (3.1 = OK; 3.12 = NOK)
|
||||
// 0 = 1 > allows only integers, no float values
|
||||
if (intval($options['decimals']) <= 0)
|
||||
{
|
||||
$step = "step='1'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$step = "step='0." . str_pad(1, intval($options['decimals']), 0, STR_PAD_LEFT) . "'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// decimal option not defined
|
||||
// check for step option (1, 0.1, 0.01, and so on)
|
||||
// or set default step 1 (integers only)
|
||||
$step = "step='" . varsettrue($options['step'], '1') . "'";
|
||||
}
|
||||
|
||||
$pattern = ' pattern="'.$options['pattern'].'"';
|
||||
}
|
||||
$options = $this->format_options('text', $name, $options);
|
||||
|
||||
//never allow id in format name-value for text fields
|
||||
if(THEME_LEGACY === false)
|
||||
{
|
||||
return "<input pattern='[0-9]*' type='number' name='{$name}' value='{$value}' {$mlength} {$min} {$max} ".$this->get_attributes($options, $name)." />";
|
||||
// return "<input pattern='[0-9]*' type='number' name='{$name}' value='{$value}' {$mlength} {$step} {$min} {$max} ".$this->get_attributes($options, $name)." />";
|
||||
return "<input type='number' name='{$name}' {$min} {$max} {$step} value='{$value}' ".$this->get_attributes($options, $name)." />";
|
||||
}
|
||||
|
||||
return $this->text($name, $value, $maxlength, $options);
|
||||
@@ -1372,7 +1437,10 @@ class e_form
|
||||
* on Submit returns unix timestamp or string value.
|
||||
* @param string $name the name of the field
|
||||
* @param integer $datestamp UNIX timestamp - default value of the field
|
||||
* @param array or str
|
||||
* @param array or str
|
||||
* @param string $options['type'] date or datetime
|
||||
* @param string $options['format'] strftime format eg. '%Y-%m-%d'
|
||||
* @param string $options['timezone'] eg. 'America/Los_Angeles' - intended timezone of the date/time entered. (offsets UTC value)
|
||||
* @example $frm->datepicker('my_field',time(),'type=date');
|
||||
* @example $frm->datepicker('my_field',time(),'type=datetime&inline=1');
|
||||
* @example $frm->datepicker('my_field',time(),'type=date&format=yyyy-mm-dd');
|
||||
@@ -1428,17 +1496,26 @@ class e_form
|
||||
$firstDay = vartrue($options['firstDay']) ? $options['firstDay'] : 0;
|
||||
$xsize = (vartrue($options['size']) && !is_numeric($options['size'])) ? $options['size'] : 'xlarge';
|
||||
$disabled = vartrue($options['disabled']) ? "disabled" : "";
|
||||
$timezone = '';
|
||||
|
||||
if(!empty($options['timezone'])) // since datetimepicker does not support timezones and assumes the browser timezone is the intended timezone.
|
||||
{
|
||||
date_default_timezone_set($options['timezone']);
|
||||
$targetOffset = date('Z');
|
||||
date_default_timezone_set(USERTIMEZONE);
|
||||
$timezone = "data-date-timezone-offset='".$targetOffset."'";
|
||||
}
|
||||
|
||||
$text = "";
|
||||
|
||||
if(vartrue($options['inline']))
|
||||
{
|
||||
$text .= "<div class='{$class}' id='inline-{$id}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}'></div>";
|
||||
$text .= "<input type='hidden' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' />";
|
||||
$text .= "<input type='hidden' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<input class='{$class} input-".$xsize." form-control' type='text' size='{$size}' id='e-datepicker-{$id}' value='{$value}' data-date-unix ='{$useUnix}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-language='".e_LAN."' data-date-firstday='{$firstDay}' {$required} {$disabled} />";
|
||||
$text .= "<input class='{$class} input-".$xsize." form-control' type='text' size='{$size}' id='e-datepicker-{$id}' value='{$value}' data-date-unix ='{$useUnix}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-language='".e_LAN."' data-date-firstday='{$firstDay}' {$required} {$disabled} {$timezone} />";
|
||||
$ftype = (!empty($options['debug'])) ? 'text' : 'hidden';
|
||||
$text .= "<input type='{$ftype}' name='{$name}' id='{$id}' value='{$hiddenValue}' />";
|
||||
}
|
||||
@@ -2637,6 +2714,7 @@ class e_form
|
||||
* @param boolean $selected [optional]
|
||||
* @param string|array $options [optional]
|
||||
* @param bool $options['useValues'] when true uses array values as the key.
|
||||
* @param array $options['disabled'] list of $option_array keys which should be disabled. eg. array('key_1', 'key_2');
|
||||
* @param bool|string $defaultBlank [optional] set to TRUE if the first entry should be blank, or to a string to use it for the blank description.
|
||||
* @return string HTML text for display
|
||||
*/
|
||||
@@ -2681,7 +2759,7 @@ class e_form
|
||||
$option_array = $new;
|
||||
}
|
||||
|
||||
$text .= $this->option_multi($option_array, $selected)."\n".$this->select_close();
|
||||
$text .= $this->option_multi($option_array, $selected, $options)."\n".$this->select_close();
|
||||
return $text;
|
||||
}
|
||||
|
||||
@@ -2863,11 +2941,13 @@ class e_form
|
||||
function option($option_title, $value, $selected = false, $options = '')
|
||||
{
|
||||
if(is_string($options)) parse_str($options, $options);
|
||||
|
||||
|
||||
if(false === $value) $value = '';
|
||||
$options = $this->format_options('option', '', $options);
|
||||
$options['selected'] = $selected; //comes as separate argument just for convenience
|
||||
|
||||
|
||||
|
||||
return "<option value='{$value}'".$this->get_attributes($options).">".defset($option_title, $option_title)."</option>";
|
||||
}
|
||||
|
||||
@@ -2889,18 +2969,24 @@ class e_form
|
||||
return $this->option('','');
|
||||
}
|
||||
|
||||
$opts = $options;
|
||||
|
||||
foreach ($option_array as $value => $label)
|
||||
foreach ((array) $option_array as $value => $label)
|
||||
{
|
||||
if(is_array($label))
|
||||
{
|
||||
$text .= $this->optgroup($value,$label,$selected,$options, 0);
|
||||
|
||||
$text .= $this->optgroup($value, $label, $selected, $options, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sel = is_array($selected) ? in_array($value, $selected) : ($value == $selected);
|
||||
|
||||
$text .= $this->option($label, $value, (is_array($selected) ? in_array($value, $selected) : $selected == $value), $options)."\n";
|
||||
if(!empty($options['disabled']))
|
||||
{
|
||||
$opts['disabled'] = in_array($value, $options['disabled']);
|
||||
}
|
||||
|
||||
$text .= $this->option($label, $value, $sel, $opts)."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2922,6 +3008,8 @@ class e_form
|
||||
$level++;
|
||||
$text = $this->optgroup_open($value, null, array('class'=>'level-'.$level));
|
||||
|
||||
$opts = $options;
|
||||
|
||||
foreach($label as $val => $lab)
|
||||
{
|
||||
if(is_array($lab))
|
||||
@@ -2930,7 +3018,12 @@ class e_form
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= $this->option($lab, $val, (is_array($selected) ? in_array($val, $selected) : $selected == $val), $options)."\n";
|
||||
if(!empty($options['disabled']))
|
||||
{
|
||||
$opts['disabled'] = in_array($val, $options['disabled']);
|
||||
}
|
||||
|
||||
$text .= $this->option($lab, $val, (is_array($selected) ? in_array($val, $selected) : $selected == $val), $opts)."\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3071,7 +3164,7 @@ class e_form
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->admin_button($name, $value, $action, $label, $options);
|
||||
|
||||
@@ -3176,6 +3269,13 @@ class e_form
|
||||
$include = (deftrue("FONTAWESOME")) ? "data-loading-icon='fa-spinner' data-disable='true'" : "";
|
||||
}
|
||||
|
||||
$confirmation = LAN_JSCONFIRM;
|
||||
|
||||
if(!empty($options['confirm']))
|
||||
{
|
||||
$confirmation = $options['confirm'];
|
||||
}
|
||||
|
||||
$options = $this->format_options('admin_button', $name, $options);
|
||||
|
||||
$options['class'] = vartrue($options['class']);
|
||||
@@ -3200,7 +3300,10 @@ class e_form
|
||||
|
||||
case 'delete':
|
||||
case 'danger':
|
||||
$options['other'] = 'data-confirm="'.LAN_JSCONFIRM.'"';
|
||||
|
||||
|
||||
|
||||
$options['other'] = 'data-confirm="'.$confirmation.'"';
|
||||
break;
|
||||
|
||||
case 'batch':
|
||||
@@ -4221,7 +4324,7 @@ class e_form
|
||||
$eModalCap = "";
|
||||
}
|
||||
|
||||
$query = http_build_query($query);
|
||||
$query = http_build_query($query, null, '&');
|
||||
$value .= "<a href='".e_SELF."?{$query}' class='btn btn-default btn-secondary".$eModal."' ".$eModalCap." title='".LAN_EDIT."' data-toggle='tooltip' data-placement='left'>
|
||||
".$editIconDefault."</a>";
|
||||
}
|
||||
@@ -5658,15 +5761,13 @@ class e_form
|
||||
$eloptions = vartrue($parms['__options'], array());
|
||||
}
|
||||
|
||||
$value = (isset($eloptions['empty']) && empty($value)) ? $eloptions['empty'] : $value;
|
||||
$value = (isset($eloptions['empty']) && ($value === null)) ? $eloptions['empty'] : $value;
|
||||
|
||||
if(is_string($eloptions)) parse_str($eloptions, $eloptions);
|
||||
if($attributes['type'] === 'comma') $eloptions['multiple'] = true;
|
||||
unset($parms['__options']);
|
||||
if(vartrue($eloptions['multiple']) && !is_array($value)) $value = explode(',', $value);
|
||||
|
||||
|
||||
|
||||
// Allow Ajax API.
|
||||
if(!empty($ajaxParms))
|
||||
{
|
||||
|
@@ -358,6 +358,21 @@ class e_jsmanager
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS file(s) for inclusion in site header in the 'library' category.
|
||||
*
|
||||
* @param string|array $file_path path, shortcodes usage is prefered
|
||||
* @param string $media any valid media attribute string - http://www.w3schools.com/TAGS/att_link_media.asp
|
||||
* @return e_jsmanager
|
||||
*/
|
||||
public function libraryCSS($file_path, $media = 'all', $preComment = '', $postComment = '')
|
||||
{
|
||||
$this->addJs('library_css', $file_path, $media, $preComment, $postComment);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add CSS file(s) for inclusion in site header
|
||||
*
|
||||
@@ -962,6 +977,14 @@ class e_jsmanager
|
||||
$runtime = true;
|
||||
break;
|
||||
|
||||
case 'library_css':
|
||||
$file_path = $runtime_location.$this->_sep.$tp->createConstants($file_path, 'mix').$this->_sep.$pre.$this->_sep.$post;
|
||||
// e107::getDebug()->log($file_path);
|
||||
if(!isset($this->_e_css['library'])) $this->_e_css['library'] = array();
|
||||
$registry = &$this->_e_css['library'];
|
||||
$runtime = true;
|
||||
break;
|
||||
|
||||
case 'inline_css': // no zones, TODO - media?
|
||||
$this->_e_css_src[] = $file_path;
|
||||
return $this;
|
||||
@@ -1129,6 +1152,11 @@ class e_jsmanager
|
||||
unset($this->_e_css['other']);
|
||||
break;
|
||||
|
||||
case 'library_css':
|
||||
$this->renderFile(varset($this->_e_css['library'], array()), $external, 'Library CSS', $mod, false);
|
||||
unset($this->_e_css['library']);
|
||||
break;
|
||||
|
||||
case 'inline_css':
|
||||
$this->renderInline($this->_e_css_src, 'Inline CSS', 'css');
|
||||
$this->_e_css_src = array();
|
||||
|
@@ -300,7 +300,7 @@ class core_library
|
||||
),
|
||||
'css' => array(
|
||||
'dist/css/bootstrap.min.css' => array(
|
||||
'zone' => 2,
|
||||
'zone' => 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1724,7 +1724,8 @@ class e_library_manager
|
||||
}
|
||||
elseif($type == 'css')
|
||||
{
|
||||
e107::css($options['type'], $data, null);
|
||||
e107::getJs()->libraryCSS($data); // load before others.
|
||||
// e107::css($options['type'], $data, null);
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
@@ -1792,21 +1792,22 @@ class e_model extends e_object
|
||||
* @param string $value
|
||||
* @return integer|float
|
||||
*/
|
||||
public function toNumber($value)
|
||||
{
|
||||
$larr = localeconv();
|
||||
$search = array(
|
||||
$larr['decimal_point'],
|
||||
$larr['mon_decimal_point'],
|
||||
$larr['thousands_sep'],
|
||||
$larr['mon_thousands_sep'],
|
||||
$larr['currency_symbol'],
|
||||
$larr['int_curr_symbol']
|
||||
);
|
||||
$replace = array('.', '.', '', '', '', '');
|
||||
// moved to e_parse
|
||||
// public function toNumber($value)
|
||||
// {
|
||||
// $larr = localeconv();
|
||||
// $search = array(
|
||||
// $larr['decimal_point'],
|
||||
// $larr['mon_decimal_point'],
|
||||
// $larr['thousands_sep'],
|
||||
// $larr['mon_thousands_sep'],
|
||||
// $larr['currency_symbol'],
|
||||
// $larr['int_curr_symbol']
|
||||
// );
|
||||
// $replace = array('.', '.', '', '', '', '');
|
||||
|
||||
return str_replace($search, $replace, $value);
|
||||
}
|
||||
// return str_replace($search, $replace, $value);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Convert object data to a string
|
||||
@@ -2704,7 +2705,8 @@ class e_front_model extends e_model
|
||||
{
|
||||
case 'int':
|
||||
case 'integer':
|
||||
return intval($this->toNumber($value));
|
||||
//return intval($this->toNumber($value));
|
||||
return intval($tp->toNumber($value));
|
||||
break;
|
||||
|
||||
case 'safestr':
|
||||
@@ -2731,7 +2733,8 @@ class e_front_model extends e_model
|
||||
break;
|
||||
|
||||
case 'float':
|
||||
return $this->toNumber($value);
|
||||
// return $this->toNumber($value);
|
||||
return $tp->toNumber($value);
|
||||
break;
|
||||
|
||||
case 'bool':
|
||||
|
@@ -867,6 +867,7 @@ class e_db_mysql
|
||||
$this->mySQLcurTable = $table;
|
||||
$REPLACE = false; // kill any PHP notices
|
||||
$DUPEKEY_UPDATE = false;
|
||||
$IGNORE = '';
|
||||
|
||||
if(is_array($arg))
|
||||
{
|
||||
@@ -885,7 +886,12 @@ class e_db_mysql
|
||||
{
|
||||
$DUPEKEY_UPDATE = true;
|
||||
unset($arg['_DUPLICATE_KEY_UPDATE']);
|
||||
}
|
||||
|
||||
if(isset($arg['_IGNORE']))
|
||||
{
|
||||
$IGNORE = ' IGNORE';
|
||||
unset($arg['_IGNORE']);
|
||||
}
|
||||
|
||||
if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data']))
|
||||
@@ -942,7 +948,7 @@ class e_db_mysql
|
||||
|
||||
if($REPLACE === false)
|
||||
{
|
||||
$query = "INSERT INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})";
|
||||
$query = "INSERT".$IGNORE." INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})";
|
||||
|
||||
if($DUPEKEY_UPDATE === true)
|
||||
{
|
||||
@@ -1301,11 +1307,13 @@ class e_db_mysql
|
||||
|
||||
case 'float':
|
||||
// fix - convert localized float numbers
|
||||
$larr = localeconv();
|
||||
$search = array($larr['decimal_point'], $larr['mon_decimal_point'], $larr['thousands_sep'], $larr['mon_thousands_sep'], $larr['currency_symbol'], $larr['int_curr_symbol']);
|
||||
$replace = array('.', '.', '', '', '', '');
|
||||
// $larr = localeconv();
|
||||
// $search = array($larr['decimal_point'], $larr['mon_decimal_point'], $larr['thousands_sep'], $larr['mon_thousands_sep'], $larr['currency_symbol'], $larr['int_curr_symbol']);
|
||||
// $replace = array('.', '.', '', '', '', '');
|
||||
|
||||
return str_replace($search, $replace, floatval($fieldValue));
|
||||
// return str_replace($search, $replace, floatval($fieldValue));
|
||||
|
||||
return e107::getParser()->toNumber($fieldValue);
|
||||
break;
|
||||
|
||||
case 'null':
|
||||
@@ -1360,11 +1368,12 @@ class e_db_mysql
|
||||
|
||||
case 'float':
|
||||
// fix - convert localized float numbers
|
||||
$larr = localeconv();
|
||||
$search = array($larr['decimal_point'], $larr['mon_decimal_point'], $larr['thousands_sep'], $larr['mon_thousands_sep'], $larr['currency_symbol'], $larr['int_curr_symbol']);
|
||||
$replace = array('.', '.', '', '', '', '');
|
||||
// $larr = localeconv();
|
||||
// $search = array($larr['decimal_point'], $larr['mon_decimal_point'], $larr['thousands_sep'], $larr['mon_thousands_sep'], $larr['currency_symbol'], $larr['int_curr_symbol']);
|
||||
// $replace = array('.', '.', '', '', '', '');
|
||||
|
||||
return str_replace($search, $replace, floatval($fieldValue));
|
||||
// return str_replace($search, $replace, floatval($fieldValue));
|
||||
return e107::getParser()->toNumber($fieldValue);
|
||||
break;
|
||||
|
||||
case 'null':
|
||||
@@ -1436,8 +1445,6 @@ class e_db_mysql
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @DEPRECATED
|
||||
Similar to db_Update(), but splits the variables and the 'WHERE' clause.
|
||||
@@ -2349,6 +2356,77 @@ class e_db_mysql
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines if a table index (key) exist.
|
||||
*
|
||||
* @param string $table - table name (no prefix)
|
||||
* @param string $keyname - Name of the key to
|
||||
* @param array $fields - OPTIONAL list of fieldnames, the index (key) must contain
|
||||
* @param boolean $retinfo = FALSE - just returns true|false. TRUE - returns all key info
|
||||
* @return array|boolean - FALSE on error, key information on success
|
||||
*/
|
||||
function index($table, $keyname, $fields=null, $retinfo = FALSE)
|
||||
{
|
||||
if(!$this->mySQLdefaultdb)
|
||||
{
|
||||
global $mySQLdefaultdb;
|
||||
$this->mySQLdefaultdb = $mySQLdefaultdb;
|
||||
}
|
||||
|
||||
if(!$this->mySQLaccess)
|
||||
{
|
||||
global $db_ConnectionID;
|
||||
$this->mySQLaccess = $db_ConnectionID;
|
||||
}
|
||||
|
||||
if (!empty($fields) && !is_array($fields))
|
||||
{
|
||||
$fields = explode(',', str_replace(' ', '', $fields));
|
||||
}
|
||||
elseif(empty($fields))
|
||||
{
|
||||
$fields = array();
|
||||
}
|
||||
|
||||
$check_field = count($fields) > 0;
|
||||
|
||||
$info = array();
|
||||
$result = $this->gen("SHOW INDEX FROM ".$this->mySQLPrefix.$table);
|
||||
if ($result && ($this->rowCount() > 0))
|
||||
{
|
||||
$c=0;
|
||||
while ($row = $this->fetch())
|
||||
{
|
||||
// Check for match of key name - and allow that key might not be used
|
||||
if($keyname == $row['Key_name'])
|
||||
{
|
||||
// a key can contain severeal fields which are returned as 1 row per field
|
||||
if (!$check_field)
|
||||
{ // Check only for keyname
|
||||
$info[] = $row;
|
||||
}
|
||||
elseif ($check_field && in_array($row['Column_name'], $fields))
|
||||
{ // Check also for fieldnames
|
||||
$info[] = $row;
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($info) > 0)
|
||||
{
|
||||
// Kex does not consist of all keys
|
||||
if ($check_field && $c != count($fields)) return false;
|
||||
// Return full information
|
||||
if ($retinfo) return $info;
|
||||
// Return only if index was found
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A pointer to mysql_real_escape_string() - see http://www.php.net/mysql_real_escape_string
|
||||
*
|
||||
|
@@ -49,7 +49,8 @@ class news {
|
||||
if(empty($news['news_title']))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||
$message = LAN_ERROR_47;
|
||||
$emessage->add(LAN_ERROR_47, E_MESSAGE_ERROR, $smessages);
|
||||
if(!empty($news['news_sef']))
|
||||
{
|
||||
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
|
||||
@@ -72,18 +73,21 @@ class news {
|
||||
if(empty($news['news_sef']))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||
$message = LAN_ERROR_48;
|
||||
$emessage->add(LAN_ERROR_48, E_MESSAGE_ERROR, $smessages);
|
||||
}
|
||||
elseif($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>'.intval($news['news_id']).' AND ' : '')."news_sef='".$tp->toDB($news['news_sef'])."'"))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR, $smessages);
|
||||
$message = LAN_ERROR_49;
|
||||
$emessage->add(LAN_ERROR_49, E_MESSAGE_ERROR, $smessages);
|
||||
}
|
||||
|
||||
if(empty($news['news_category']))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News category can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||
$message = LAN_ERROR_50;
|
||||
$emessage->add(LAN_ERROR_50, E_MESSAGE_ERROR, $smessages);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -76,6 +76,7 @@ class e_plugin
|
||||
'e_user',
|
||||
'e_library', // For third-party libraries are defined by plugins/themes.
|
||||
'e_gsitemap',
|
||||
'e_output', //hook into all pages at the end (after closing </html>)
|
||||
);
|
||||
|
||||
|
||||
@@ -1069,6 +1070,7 @@ class e107plugin
|
||||
'e_user',
|
||||
'e_library', // For third-party libraries are defined by plugins/themes.
|
||||
'e_gsitemap',
|
||||
'e_output', //hook into all pages at the end (after closing </html>)
|
||||
);
|
||||
|
||||
|
||||
@@ -1114,8 +1116,8 @@ class e107plugin
|
||||
'e_upload' => "Use data from your plugin in the user upload form.",
|
||||
'e_user' => "Have your plugin include data on the user-profile page.",
|
||||
'e_library' => "Include a third-party library",
|
||||
'e_parse' => "Hook into e107's text/html parser"
|
||||
|
||||
'e_parse' => "Hook into e107's text/html parser",
|
||||
'e_output' => "Hook into all pages at the end (after closing </html>)"
|
||||
);
|
||||
|
||||
|
||||
|
@@ -577,7 +577,7 @@ class e_validator
|
||||
break;
|
||||
|
||||
case 'float':
|
||||
$value = $this->toNumber($value);
|
||||
$value = e107::getParser()->toNumber($value);
|
||||
if(!is_numeric($value))
|
||||
{
|
||||
$this->addValidateResult($name, self::ERR_FLOAT_EXPECTED);
|
||||
@@ -728,22 +728,23 @@ class e_validator
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function toNumber($value)
|
||||
{
|
||||
$larr = localeconv();
|
||||
$search = array(
|
||||
$larr['decimal_point'],
|
||||
$larr['mon_decimal_point'],
|
||||
$larr['thousands_sep'],
|
||||
$larr['mon_thousands_sep'],
|
||||
$larr['currency_symbol'],
|
||||
$larr['int_curr_symbol']
|
||||
);
|
||||
$replace = array('.', '.', '', '', '', '');
|
||||
|
||||
// moved to e_parse
|
||||
// public function toNumber($value)
|
||||
// {
|
||||
// $larr = localeconv();
|
||||
// $search = array(
|
||||
// $larr['decimal_point'],
|
||||
// $larr['mon_decimal_point'],
|
||||
// $larr['thousands_sep'],
|
||||
// $larr['mon_thousands_sep'],
|
||||
// $larr['currency_symbol'],
|
||||
// $larr['int_curr_symbol']
|
||||
// );
|
||||
// $replace = array('.', '.', '', '', '', '');
|
||||
|
||||
return str_replace($search, $replace, $value);
|
||||
}
|
||||
// return str_replace($search, $replace, $value);
|
||||
// }
|
||||
|
||||
protected function parseMinMax($string)
|
||||
{
|
||||
|
@@ -64,4 +64,8 @@ define("LAN_ERROR_44", "Site logo");
|
||||
|
||||
define("LAN_ERROR_45", "What can you do now?");
|
||||
define("LAN_ERROR_46", "Check log for details.");
|
||||
define("LAN_ERROR_47", "Validation error: News title can't be empty!");
|
||||
define("LAN_ERROR_48", "Validation error: News SEF URL value is required field and can't be empty!");
|
||||
define("LAN_ERROR_49", "Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.");
|
||||
define("LAN_ERROR_50", "Validation error: News category can't be empty!");
|
||||
?>
|
||||
|
@@ -11,8 +11,8 @@
|
||||
*/
|
||||
define("PAGE_NAME", "User Posts");
|
||||
|
||||
define("UP_LAN_0", "All Forum Posts for ");
|
||||
define("UP_LAN_1", "All Comments for ");
|
||||
define("UP_LAN_0", "All Forum Posts for [x]");
|
||||
define("UP_LAN_1", "All Comments for [x]");
|
||||
define("UP_LAN_2", "Thread");
|
||||
define("UP_LAN_3", "Views");
|
||||
define("UP_LAN_4", "Replies");
|
||||
@@ -28,4 +28,4 @@ define("UP_LAN_12", "Search");
|
||||
define("UP_LAN_14", "Forum Posts");
|
||||
define("UP_LAN_15", "Re");
|
||||
define("UP_LAN_16", "IP Address");
|
||||
?>
|
||||
?>
|
||||
|
@@ -145,4 +145,6 @@ define("LAN_CUSTOMTITLE", "Custom title");
|
||||
define("LAN_USET_5", "Subscribed to");
|
||||
define("LAN_USET_6", "Subscribe to our mailing-list(s) and/or sections of this site.");
|
||||
// define("LAN_USET_8", "Signature / Time zone");
|
||||
?>
|
||||
|
||||
define("LAN_USET_50", "Delete Account");
|
||||
define("LAN_USET_51", "Are you sure? This procedure cannot be reversed! Once completed, your account and any personal data that you have entered on this site will be permanently lost and you will no longer be able to login.");
|
@@ -78,6 +78,96 @@ if(!class_exists("_blank_setup"))
|
||||
// print_a($var);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Call During Upgrade Check. May be used to check for existance of tables etc and if not found return TRUE to call for an upgrade.
|
||||
*
|
||||
* @return bool true = upgrade required; false = upgrade not required
|
||||
*/
|
||||
function upgrade_required()
|
||||
{
|
||||
// Check if a specific table exists and if not, return true to force a db update
|
||||
// In this example, it checks if the table "blank_table" exists
|
||||
// if(!e107::getDb()->isTable('blank_table'))
|
||||
// {
|
||||
// return true; // true to trigger an upgrade alert, and false to not.
|
||||
// }
|
||||
|
||||
|
||||
// Check if a specific field exists in the specified table
|
||||
// and if not return false to force a db update to add this field
|
||||
// from the "_blank_sql.php" file
|
||||
// In this case: Exists field "blank_id" in table "blank_table"
|
||||
// if(!e107::getDb()->field('blank_table','blank_id'))
|
||||
// {
|
||||
// return true; // true to trigger an upgrade alert, and false to not.
|
||||
// }
|
||||
|
||||
|
||||
// In case you need to delete a field that is not used anymore,
|
||||
// first check if the field exists, than run a sql command to drop (delete) the field
|
||||
// !!! ATTENTION !!!
|
||||
// !!! Deleting a field, deletes also the data stored in that field !!!
|
||||
// !!! Make sure you know what you are doing !!!
|
||||
//
|
||||
// In this example, the field "blank_unused_field" from table "blank_table"
|
||||
// isn't used anymore and will be deleted (dropped) if it still exists
|
||||
// if(e107::getDb()->field('blank_table', 'blank_unused_field'))
|
||||
// {
|
||||
// this statement directly deletes the field, an additional
|
||||
// db update isn't needed anymore, if this is the only change on the db/table.
|
||||
// e107::getDb()->gen("ALTER TABLE `#blank_table` DROP `blank_unused_field` ");
|
||||
// }
|
||||
|
||||
|
||||
// In case you need to delete a index that is not used anymore,
|
||||
// first check if the index exists, than run a sql command to drop (delete) the field
|
||||
// Be aware, that deleting an index is not very harmfull, as the data of the
|
||||
// index will be recreated when the index is added again.
|
||||
// if(e107::getDb()->index('blank_table','blank_unused_index'))
|
||||
// {
|
||||
// this statement directly deletes the index, an additional
|
||||
// db update isn't needed anymore, if this is the only change on the db/table.
|
||||
// e107::getDb()->gen("ALTER TABLE `#blank_table` DROP INDEX `blank_unused_index` ");
|
||||
// }
|
||||
|
||||
// In case you need to check an index and which fields it is build of,
|
||||
// use the fourth parameter to return the index definition.
|
||||
// In this case, the index should be deleted if consists only of 1 field ("blank_fieldname"),
|
||||
// if(e107::getDb()->index('blank_table','blank_unused_index', array('blank_fieldname')))
|
||||
// {
|
||||
// this statement directly deletes the index, an additional
|
||||
// db update isn't needed anymore, if this is the only change on the db/table.
|
||||
// e107::getDb()->gen("ALTER TABLE `#blank_table` DROP INDEX `blank_unused_index` ");
|
||||
// }
|
||||
|
||||
|
||||
// In case you need to check an index and which fields it is build of,
|
||||
// use the third parameter to return the index definition.
|
||||
// In this case, the index should be deleted if consists only of 1 field ("blank_fieldname"),
|
||||
// if ($index_def = e107::getDb()->index('blank_table','blank_unused_index', array('blank_fieldname')))
|
||||
// {
|
||||
// Check if the key should be UNIQUE
|
||||
// $unique = array_count_values(array_column($index_def, 'Non_unique'));
|
||||
// if($unique[1] > 0) // Keys are not unique
|
||||
// {
|
||||
// this statement directly deletes the index, an additional
|
||||
// db update isn't needed anymore, if this is the only change on the db/table.
|
||||
// e107::getDb()->gen("ALTER TABLE `#blank_table` DROP INDEX `blank_unused_index` ");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$legacyMenuPref = e107::getConfig('menu')->getPref();
|
||||
if(isset($legacyMenuPref['newforumposts_caption']))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function upgrade_post($var)
|
||||
{
|
||||
// $sql = e107::getDb();
|
||||
|
@@ -1,3 +1,48 @@
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* INFORMATION
|
||||
*
|
||||
* BEFORE DOING ANY DATABASE CHANGES OR UPDATES, CREATE A FRESH BACKUP!!!
|
||||
*
|
||||
* Add the SQL statements for your table here.
|
||||
* Make sure that you do not add the e107 table prefix (by default e107) to the table name!!
|
||||
* This file will be analyzed on plugin install and missing tables will be installed automatically.
|
||||
* To check if the table structure is still valid, run the "Tools -> Database -> Check for Updates" command.
|
||||
* Any differences between the defined structure here and the table structure on the server will than be detected.
|
||||
* In another step, you are able to update the table structure to the latest version from this file!
|
||||
*
|
||||
*
|
||||
* For the moment, the following operations are supported:
|
||||
* -------------------------------------------------------
|
||||
* - Create table
|
||||
* - Change field type, field size, field null or not, field default value
|
||||
* - Add index
|
||||
*
|
||||
*
|
||||
* What is currently NOT supported:
|
||||
* --------------------------------
|
||||
* - Rename table (by renaming the tablename, e.g. "blank" > "blank2"). The renamed table will be considered as new!
|
||||
* - Drop a table (e.g. if you remove the "blank" table definition from this file, the table will NOT be deleted from the database!)
|
||||
* - Rename or drop a field (a renamed field will be considered new, a missing field definition will NOT be recognized at all!)
|
||||
* - Change an index/key (e.g. the change is recognized, but leads to an error message and the change is not applied)
|
||||
* - Rename or drop an index/key (Rename is recognized as a new index and the missing index is not recognized at all!)
|
||||
* - A field definition containing "NULL DEFAULT NULL". The "Check for updates" method will always detect a change,
|
||||
* but fails silently when trying to update. In that case remove the first "NULL" and run the the "Check for updates" again.
|
||||
*
|
||||
*
|
||||
* How to rename or drop tables, fields and indexes or modify indexes:
|
||||
* -------------------------------------------------------------------
|
||||
* There are methods that can be used to detect tables, fields and indexes. Some examples of how to use them
|
||||
* can be found in the "_blank_setup.php". There are also examples on how to drop a field or index or to check for specific properties.
|
||||
* Other examples can be found also in the "forum_setup.php"
|
||||
*/
|
||||
|
||||
|
||||
CREATE TABLE blank (
|
||||
`blank_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`blank_icon` varchar(255) NOT NULL,
|
||||
|
@@ -25,16 +25,30 @@ class _blank_user // plugin-folder + '_user'
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fields()
|
||||
/**
|
||||
* Experimental and subject to change without notice.
|
||||
* @return mixed
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
|
||||
$fields = array(
|
||||
|
||||
|
||||
|
||||
$config['user'] = array(
|
||||
'user_id' => '[primary]',
|
||||
'user_name' => '[unique]',
|
||||
'user_loginname' => '[unique]',
|
||||
'user_email' => '[unique]',
|
||||
'user_ip' => '',
|
||||
// etc.
|
||||
'WHERE' => 'user_id = '.USERID,
|
||||
'MODE' => 'update'
|
||||
);
|
||||
|
||||
$config['user_extended'] = array(
|
||||
'WHERE' => 'user_extended_id = '.USERID,
|
||||
'MODE' => 'delete'
|
||||
);
|
||||
|
||||
return $config;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -291,7 +291,7 @@ class download_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
return "<a href='".e_REQUEST_SELF."?".http_build_query($qry)."'>".$text."</a>" ;
|
||||
return "<a href='".e_REQUEST_SELF."?".http_build_query($qry, null, '&')."'>".$text."</a>" ;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
require_once('SecureLinkDecorator.php');
|
||||
|
||||
class NginxSecureLinkMd5Decorator implements SecureLinkDecorator
|
||||
{
|
||||
protected $url = null;
|
||||
protected $prefs = array();
|
||||
|
||||
public static $SUPPORTED_VARIABLES = array(
|
||||
'$secure_link_expires',
|
||||
'$uri',
|
||||
'$remote_addr'
|
||||
);
|
||||
|
||||
static function supported_variables() {
|
||||
return self::$SUPPORTED_VARIABLES;
|
||||
}
|
||||
|
||||
function __construct($url, $preferences)
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->prefs = $preferences;
|
||||
}
|
||||
|
||||
public function decorate()
|
||||
{
|
||||
$prefs = $this->prefs;
|
||||
$url = $this->url;
|
||||
$expiry = intval($prefs['download_security_link_expiry']);
|
||||
if ($expiry <= 0)
|
||||
$expiry = PHP_INT_MAX;
|
||||
else
|
||||
$expiry = time() + $expiry;
|
||||
$url_parts = parse_url($url);
|
||||
$evaluation = str_replace(
|
||||
self::supported_variables(),
|
||||
array(
|
||||
$expiry,
|
||||
$url_parts['path'],
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
),
|
||||
$prefs['download_security_expression']
|
||||
);
|
||||
$query_string = $url_parts['query'];
|
||||
parse_str($query_string, $query_args);
|
||||
$query_args['md5'] = str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode(md5($evaluation, true)));
|
||||
if (strpos($prefs['download_security_expression'], '$secure_link_expires') !== false)
|
||||
$query_args['expires'] = $expiry;
|
||||
require_once(__DIR__ . '/../vendor/shim_http_build_url.php');
|
||||
return http_build_url($url_parts, array('query' => http_build_query($query_args)));
|
||||
}
|
||||
}
|
6
e107_plugins/download/handlers/SecureLinkDecorator.php
Normal file
6
e107_plugins/download/handlers/SecureLinkDecorator.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
interface SecureLinkDecorator
|
||||
{
|
||||
public function decorate();
|
||||
}
|
@@ -286,7 +286,11 @@ class download_main_admin_ui extends e_admin_ui
|
||||
//required - default column user prefs
|
||||
protected $fieldpref = array('checkboxes', 'download_image', 'download_id', 'download_datestamp', 'download_category', 'download_name', 'download_active', 'download_class', 'fb_order', 'options');
|
||||
|
||||
//
|
||||
// Security modes
|
||||
protected $security_options = array(
|
||||
'none' => LAN_DL_SECURITY_MODE_NONE,
|
||||
'nginx-secure_link_md5' => LAN_DL_SECURITY_MODE_NGINX_SECURELINKMD5
|
||||
);
|
||||
|
||||
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
|
||||
//protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||
@@ -1133,22 +1137,32 @@ $columnInfo = array(
|
||||
global $admin_log,$pref;
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$expected_params = array(
|
||||
'download_php', 'download_view', 'download_sort', 'download_order',
|
||||
'mirror_order', 'recent_download_days', 'agree_flag', 'download_email',
|
||||
'agree_text', 'download_denied', 'download_reportbroken',
|
||||
'download_security_mode', 'download_security_expression', 'download_security_link_expiry'
|
||||
);
|
||||
|
||||
$temp = array();
|
||||
$temp['download_php'] = $_POST['download_php'];
|
||||
$temp['download_view'] = $_POST['download_view'];
|
||||
$temp['download_sort'] = $_POST['download_sort'];
|
||||
$temp['download_order'] = $_POST['download_order'];
|
||||
$temp['mirror_order'] = $_POST['mirror_order'];
|
||||
$temp['recent_download_days'] = $_POST['recent_download_days'];
|
||||
$temp['agree_flag'] = $_POST['agree_flag'];
|
||||
$temp['download_email'] = $_POST['download_email'];
|
||||
$temp['agree_text'] = $tp->toDB($_POST['agree_text']);
|
||||
$temp['download_denied'] = $tp->toDB($_POST['download_denied']);
|
||||
$temp['download_reportbroken'] = $_POST['download_reportbroken'];
|
||||
|
||||
if ($_POST['download_subsub']) $temp['download_subsub'] = '1'; else $temp['download_subsub'] = '0';
|
||||
if ($_POST['download_incinfo']) $temp['download_incinfo'] = '1'; else $temp['download_incinfo'] = '0';
|
||||
foreach($expected_params as $expected_param)
|
||||
{
|
||||
$temp[$expected_param] = $_POST[$expected_param];
|
||||
}
|
||||
|
||||
$temp['download_subsub'] = $_POST['download_subsub'] ? '1' : '0';
|
||||
$temp['download_incinfo'] = $_POST['download_incinfo'] ? '1' : '0';
|
||||
|
||||
if ($_POST['download_security_mode'] !== 'nginx-secure_link_md5')
|
||||
{
|
||||
unset($temp['download_security_mode']);
|
||||
unset($temp['download_security_expression']);
|
||||
unset($temp['download_security_link_expiry']);
|
||||
e107::getConfig('core')->removePref('download_security_mode');
|
||||
e107::getConfig('core')->removePref('download_security_expression');
|
||||
e107::getConfig('core')->removePref('download_security_link_expiry');
|
||||
}
|
||||
|
||||
e107::getConfig('core')->setPref($temp)->save(false);
|
||||
|
||||
@@ -2093,14 +2107,33 @@ $columnInfo = array(
|
||||
}
|
||||
}
|
||||
|
||||
private function supported_secure_link_variables_html()
|
||||
{
|
||||
require_once(__DIR__."/../handlers/NginxSecureLinkMd5Decorator.php");
|
||||
$supported_secure_link_variables_html = "<ul>";
|
||||
foreach(NginxSecureLinkMd5Decorator::supported_variables() as $variable)
|
||||
{
|
||||
$supported_secure_link_variables_html .= "<li><code>$variable</code></li>";
|
||||
}
|
||||
$supported_secure_link_variables_html .= "</ul>";
|
||||
return $supported_secure_link_variables_html;
|
||||
}
|
||||
|
||||
private function mirror_order_options_html($pref)
|
||||
{
|
||||
return ($pref['mirror_order'] == "0" ? "<option value='0' selected='selected'>".DOWLAN_161."</option>" : "<option value='0'>".DOWLAN_161."</option>").
|
||||
($pref['mirror_order'] == "1" ? "<option value='1' selected='selected'>".LAN_ID."</option>" : "<option value='1'>".LAN_ID."</option>").
|
||||
($pref['mirror_order'] == "2" ? "<option value='2' selected='selected'>".DOWLAN_12."</option>" : "<option value='2'>".DOWLAN_12."</option>");
|
||||
}
|
||||
|
||||
function show_download_options()
|
||||
{
|
||||
global $pref, $ns;
|
||||
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$frm = new e_form(true); //enable inner tabindex counter
|
||||
|
||||
$agree_flag = $pref['agree_flag'];
|
||||
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$frm = new e_form(true); //enable inner tabindex counter
|
||||
|
||||
$agree_flag = $pref['agree_flag'];
|
||||
$agree_text = $pref['agree_text'];
|
||||
$c = $pref['download_php'] ? " checked = 'checked' " : "";
|
||||
$sacc = (varset($pref['download_incinfo'],0) == '1') ? " checked = 'checked' " : "";
|
||||
@@ -2115,14 +2148,15 @@ $columnInfo = array(
|
||||
"ASC" => DOWLAN_62,
|
||||
"DESC" => DOWLAN_63
|
||||
);
|
||||
|
||||
|
||||
$text = "
|
||||
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><a data-toggle='tab' href='#core-download-download1'>".LAN_DL_DOWNLOAD_OPT_GENERAL."</a></li>
|
||||
<li><a data-toggle='tab' href='#core-download-download2'>".LAN_DL_DOWNLOAD_OPT_BROKEN."</a></li>
|
||||
<li><a data-toggle='tab' href='#core-download-download3'>".LAN_DL_DOWNLOAD_OPT_AGREE."</a></li>
|
||||
<li><a data-toggle='tab' href='#core-download-download4'>".LAN_DL_UPLOAD."</a></li>
|
||||
<li><a data-toggle='tab' href='#core-download-download4'>".LAN_DL_DOWNLOAD_OPT_SECURITY."</a></li>
|
||||
<li><a data-toggle='tab' href='#core-download-download5'>".LAN_DL_UPLOAD."</a></li>
|
||||
</ul>
|
||||
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
|
||||
@@ -2170,10 +2204,7 @@ $columnInfo = array(
|
||||
<tr>
|
||||
<td>".DOWLAN_160."</td>
|
||||
<td>
|
||||
<select name='mirror_order' class='form-control'>".
|
||||
($pref['mirror_order'] == "0" ? "<option value='0' selected='selected'>".DOWLAN_161."</option>" : "<option value='0'>".DOWLAN_161."</option>").
|
||||
($pref['mirror_order'] == "1" ? "<option value='1' selected='selected'>".LAN_ID."</option>" : "<option value='1'>".LAN_ID."</option>").
|
||||
($pref['mirror_order'] == "2" ? "<option value='2' selected='selected'>".DOWLAN_163."</option>" : "<option value='2'>".DOWLAN_12."</option>")."
|
||||
<select name='mirror_order' class='form-control'>".$this->mirror_order_options_html($pref)."
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2226,6 +2257,45 @@ $columnInfo = array(
|
||||
</div>
|
||||
</div>
|
||||
<div class='tab-pane' id='core-download-download4'>
|
||||
<div>
|
||||
<p style='padding: 8px'>
|
||||
".LAN_DL_SECURITY_DESCRIPTION."
|
||||
</p>
|
||||
<table class='table adminform'>
|
||||
<colgroup>
|
||||
<col style='width:30%'/>
|
||||
<col style='width:70%'/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>".LAN_DL_SECURITY_MODE."</td>
|
||||
<td>".$frm->select('download_security_mode', $this->security_options, $pref['download_security_mode'])."</td>
|
||||
</tr>
|
||||
<tbody id='nginx-secure_link_md5' ".($pref['download_security_mode'] === 'nginx-secure_link_md5' ? "" : "style='display:none'").">
|
||||
<tr>
|
||||
<td>".LAN_DL_SECURITY_NGINX_SECURELINKMD5_EXPRESSION."</td>
|
||||
<td>
|
||||
".$frm->text('download_security_expression', $pref['download_security_expression'], 1024)."
|
||||
<div class='field-help'>".LAN_DL_SECURITY_NGINX_SECURELINKMD5_EXPRESSION_HELP."</div>
|
||||
<small><a href='#' onclick='event.preventDefault();$(\"#supported-nginx-variables\").toggle();this.blur()'>
|
||||
".LAN_DL_SECURITY_NGINX_SUPPORTED_VARIABLES_TOGGLE."
|
||||
</a></small>
|
||||
<div id='supported-nginx-variables' style='display:none'>
|
||||
".$this->supported_secure_link_variables_html()."
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".LAN_DL_SECURITY_LINK_EXPIRY."</td>
|
||||
<td>
|
||||
".$frm->text('download_security_link_expiry', $pref['download_security_link_expiry'], 16, array('pattern' => '\d+'))."
|
||||
<div class='field-help'>".LAN_DL_SECURITY_LINK_EXPIRY_HELP."</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class='tab-pane' id='core-download-download5'>
|
||||
<div>
|
||||
<table class='table adminform'>
|
||||
<colgroup>
|
||||
@@ -2246,7 +2316,20 @@ $columnInfo = array(
|
||||
</div>
|
||||
</form>
|
||||
";
|
||||
// $ns->tablerender(LAN_DL_OPTIONS, $text);
|
||||
|
||||
e107::js('footer-inline', "
|
||||
$('#download-security-mode').on('change', function() {
|
||||
var mode = $(this).val();
|
||||
|
||||
if (mode == 'nginx-secure_link_md5') {
|
||||
$('#nginx-secure_link_md5').show('slow');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#nginx-secure_link_md5').hide('slow');
|
||||
});
|
||||
");
|
||||
|
||||
echo $text;
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@ define("LAN_DL_OPTIONS", "Options"); //FIXME Use Generic
|
||||
define("LAN_DL_DOWNLOAD_OPT_GENERAL", "General");
|
||||
define("LAN_DL_DOWNLOAD_OPT_BROKEN", "Reporting");
|
||||
define("LAN_DL_DOWNLOAD_OPT_AGREE", "Agreements");
|
||||
define("LAN_DL_DOWNLOAD_OPT_SECURITY", "Protection");
|
||||
define("LAN_DL_UPLOAD", "Upload"); //FIXME Use Generic
|
||||
define("LAN_DL_USE_PHP", "Use PHP");
|
||||
define("LAN_DL_USE_PHP_INFO", "Checking this will send all download requests through PHP");
|
||||
@@ -228,4 +229,17 @@ define("DOWLAN_HELP_10", "Help for upload options");
|
||||
// define("DOWLAN_INSTALL_DONE", "Your download plugin is now installed");
|
||||
// define("DOWLAN_DESCRIPTION", "This plugin is a fully featured Download system");
|
||||
// define("DOWLAN_CAPTION", "Configure Download");
|
||||
?>
|
||||
|
||||
define("LAN_DL_SECURITY_DESCRIPTION", "Downloads can make use of server-side URL protection features to prevent hotlinking and/or enforce link expiry. " .
|
||||
"This section should be configured before the download server is configured to reduce the chance of disruption to downloaders.");
|
||||
define("LAN_DL_SECURITY_MODE", "URL protection mode");
|
||||
define("LAN_DL_SECURITY_MODE_NONE", "None (Default)");
|
||||
define("LAN_DL_SECURITY_MODE_NGINX_SECURELINKMD5", "NGINX secure_link_md5");
|
||||
define("LAN_DL_SECURITY_NGINX_SUPPORTED_VARIABLES_TOGGLE", "Click to toggle list of supported NGINX variables");
|
||||
define("LAN_DL_SECURITY_NGINX_SECURELINKMD5_EXPRESSION",
|
||||
"<a target='_blank' href='https://nginx.org/en/docs/http/ngx_http_secure_link_module.html#secure_link_md5'>NGINX secure_link_md5 expression</a>");
|
||||
define("LAN_DL_SECURITY_NGINX_SECURELINKMD5_EXPRESSION_HELP", "Same expression as configured on the server");
|
||||
define("LAN_DL_SECURITY_LINK_EXPIRY", "Duration of validity in seconds");
|
||||
define("LAN_DL_SECURITY_LINK_EXPIRY_HELP", "Number of seconds the download link should last after being generated. " .
|
||||
"Only effective if the expression supports expiry time. " .
|
||||
"Defaults to a very long time if this field is left blank.");
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e107Plugin name="Downloads" lan="LAN_PLUGIN_DOWNLOAD_NAME" version="1.1" date="2017-04-27" compatibility="2.0" installRequired="true">
|
||||
<e107Plugin name="Downloads" lan="LAN_PLUGIN_DOWNLOAD_NAME" version="1.2" date="2018-05-01" 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>
|
||||
<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>
|
||||
|
@@ -72,7 +72,7 @@ if(strstr(e_QUERY, "mirror"))
|
||||
}
|
||||
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '".intval($download_id)."'");
|
||||
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '".intval($mirror_id)."'");
|
||||
header("Location: {$gaddress}");
|
||||
header("Location: ".decorate_download_location($gaddress));
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ if ($type == "file")
|
||||
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '".intval($download_id)."'");
|
||||
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '".intval($mirror_id)."'");
|
||||
|
||||
header("Location: ".$gaddress);
|
||||
header("Location: ".decorate_download_location($gaddress));
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ if ($type == "file")
|
||||
if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://"))
|
||||
{
|
||||
$download_url = e107::getParser()->parseTemplate($download_url,true); // support for shortcode-driven dynamic URLS.
|
||||
e107::redirect($download_url);
|
||||
e107::redirect(decorate_download_location($download_url));
|
||||
// header("Location: {$download_url}");
|
||||
exit();
|
||||
}
|
||||
@@ -435,4 +435,12 @@ function check_download_limits()
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
function decorate_download_location($url)
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
if ($pref['download_security_mode'] !== 'nginx-secure_link_md5')
|
||||
return $url;
|
||||
require_once(__DIR__."/handlers/NginxSecureLinkMd5Decorator.php");
|
||||
$decorator = new NginxSecureLinkMd5Decorator($url, $pref);
|
||||
return $decorator->decorate();
|
||||
}
|
104
e107_plugins/download/vendor/shim_http_build_url.php
vendored
Normal file
104
e107_plugins/download/vendor/shim_http_build_url.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if (!function_exists('http_build_url'))
|
||||
{
|
||||
define('HTTP_URL_REPLACE', 1); // Replace every part of the first URL when there's one of the second URL
|
||||
define('HTTP_URL_JOIN_PATH', 2); // Join relative paths
|
||||
define('HTTP_URL_JOIN_QUERY', 4); // Join query strings
|
||||
define('HTTP_URL_STRIP_USER', 8); // Strip any user authentication information
|
||||
define('HTTP_URL_STRIP_PASS', 16); // Strip any password authentication information
|
||||
define('HTTP_URL_STRIP_AUTH', 32); // Strip any authentication information
|
||||
define('HTTP_URL_STRIP_PORT', 64); // Strip explicit port numbers
|
||||
define('HTTP_URL_STRIP_PATH', 128); // Strip complete path
|
||||
define('HTTP_URL_STRIP_QUERY', 256); // Strip query string
|
||||
define('HTTP_URL_STRIP_FRAGMENT', 512); // Strip any fragments (#identifier)
|
||||
define('HTTP_URL_STRIP_ALL', 1024); // Strip anything but scheme and host
|
||||
|
||||
// Build an URL
|
||||
// The parts of the second URL will be merged into the first according to the flags argument.
|
||||
//
|
||||
// @param mixed (Part(s) of) an URL in form of a string or associative array like parse_url() returns
|
||||
// @param mixed Same as the first argument
|
||||
// @param int A bitmask of binary or'ed HTTP_URL constants (Optional)HTTP_URL_REPLACE is the default
|
||||
// @param array If set, it will be filled with the parts of the composed url like parse_url() would return
|
||||
function http_build_url($url, $parts=array(), $flags=HTTP_URL_REPLACE, &$new_url=false)
|
||||
{
|
||||
$keys = array('user','pass','port','path','query','fragment');
|
||||
|
||||
// HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs
|
||||
if ($flags & HTTP_URL_STRIP_ALL)
|
||||
{
|
||||
$flags |= HTTP_URL_STRIP_USER;
|
||||
$flags |= HTTP_URL_STRIP_PASS;
|
||||
$flags |= HTTP_URL_STRIP_PORT;
|
||||
$flags |= HTTP_URL_STRIP_PATH;
|
||||
$flags |= HTTP_URL_STRIP_QUERY;
|
||||
$flags |= HTTP_URL_STRIP_FRAGMENT;
|
||||
}
|
||||
// HTTP_URL_STRIP_AUTH becomes HTTP_URL_STRIP_USER and HTTP_URL_STRIP_PASS
|
||||
else if ($flags & HTTP_URL_STRIP_AUTH)
|
||||
{
|
||||
$flags |= HTTP_URL_STRIP_USER;
|
||||
$flags |= HTTP_URL_STRIP_PASS;
|
||||
}
|
||||
|
||||
// Parse the original URL
|
||||
$parse_url = !is_array($url) ? parse_url($url) : $url;
|
||||
|
||||
// Scheme and Host are always replaced
|
||||
if (isset($parts['scheme']))
|
||||
$parse_url['scheme'] = $parts['scheme'];
|
||||
if (isset($parts['host']))
|
||||
$parse_url['host'] = $parts['host'];
|
||||
|
||||
// (If applicable) Replace the original URL with it's new parts
|
||||
if ($flags & HTTP_URL_REPLACE)
|
||||
{
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if (isset($parts[$key]))
|
||||
$parse_url[$key] = $parts[$key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Join the original URL path with the new path
|
||||
if (isset($parts['path']) && ($flags & HTTP_URL_JOIN_PATH))
|
||||
{
|
||||
if (isset($parse_url['path']))
|
||||
$parse_url['path'] = rtrim(str_replace(basename($parse_url['path']), '', $parse_url['path']), '/') . '/' . ltrim($parts['path'], '/');
|
||||
else
|
||||
$parse_url['path'] = $parts['path'];
|
||||
}
|
||||
|
||||
// Join the original query string with the new query string
|
||||
if (isset($parts['query']) && ($flags & HTTP_URL_JOIN_QUERY))
|
||||
{
|
||||
if (isset($parse_url['query']))
|
||||
$parse_url['query'] .= '&' . $parts['query'];
|
||||
else
|
||||
$parse_url['query'] = $parts['query'];
|
||||
}
|
||||
}
|
||||
|
||||
// Strips all the applicable sections of the URL
|
||||
// Note: Scheme and Host are never stripped
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if ($flags & (int)constant('HTTP_URL_STRIP_' . strtoupper($key)))
|
||||
unset($parse_url[$key]);
|
||||
}
|
||||
|
||||
|
||||
$new_url = $parse_url;
|
||||
|
||||
return
|
||||
((isset($parse_url['scheme'])) ? $parse_url['scheme'] . '://' : '')
|
||||
.((isset($parse_url['user'])) ? $parse_url['user'] . ((isset($parse_url['pass'])) ? ':' . $parse_url['pass'] : '') .'@' : '')
|
||||
.((isset($parse_url['host'])) ? $parse_url['host'] : '')
|
||||
.((isset($parse_url['port'])) ? ':' . $parse_url['port'] : '')
|
||||
.((isset($parse_url['path'])) ? $parse_url['path'] : '')
|
||||
.((isset($parse_url['query'])) ? '?' . $parse_url['query'] : '')
|
||||
.((isset($parse_url['fragment'])) ? '#' . $parse_url['fragment'] : '')
|
||||
;
|
||||
}
|
||||
}
|
@@ -116,7 +116,7 @@ if(!deftrue('OLD_FORUMADMIN'))
|
||||
protected $pid = 'forum_id';
|
||||
protected $perPage = 30;
|
||||
protected $batchDelete = true;
|
||||
// protected $batchCopy = true;
|
||||
protected $batchCopy = true;
|
||||
protected $sortField = 'forum_order';
|
||||
protected $sortParent = 'forum_parent';
|
||||
protected $orderStep = 50;
|
||||
|
@@ -345,7 +345,7 @@ $FORUM_VIEWFORUM_TEMPLATE['divider-normal'] = "<tr><th colspan='2'>".LAN_FORUM_
|
||||
$FORUM_VIEWFORUM_TEMPLATE['divider-important'] = "<tr><th colspan='2'>".LAN_FORUM_1006."</th><th class='text-center'>".LAN_FORUM_0003."</th><th class='hidden-xs text-center'>".LAN_FORUM_1005."</th><th class='hidden-xs'>".LAN_FORUM_0004."</th></tr>";
|
||||
$FORUM_VIEWFORUM_TEMPLATE['divider-normal'] = "<tr><th colspan='2'>".LAN_FORUM_1007."</th><th class='text-center' >".LAN_FORUM_0003."</th><th class='hidden-xs text-center'>".LAN_FORUM_1005."</th><th class='hidden-xs'>".LAN_FORUM_0004."</th></tr>";
|
||||
|
||||
$SC_WRAPPER['VIEWABLE_BY'] = "<div class='panel panel-default' style='margin-top:10px'><div class='panel-heading'>".LAN_FORUM_8012."</div><div class='panel-body'>{---}</div></div></div>";
|
||||
$SC_WRAPPER['VIEWABLE_BY'] = "<div class='panel panel-default' style='margin-top:10px'><div class='panel-heading'>".LAN_FORUM_8012."</div><div class='panel-body'>{---}</div></div>";
|
||||
|
||||
$FORUM_VIEWFORUM_TEMPLATE['footer'] = "</table>
|
||||
<div class='row row-fluid'>
|
||||
|
@@ -23,7 +23,15 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
|
||||
|
||||
// e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.3/tinymce.min.js');
|
||||
|
||||
e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.8/tinymce.min.js');
|
||||
// e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.11/tinymce.min.js');
|
||||
/**
|
||||
* tinymce 4.7.10 and newer do not work.
|
||||
* Looks like an issue introduced with 4.7.10
|
||||
* Reverting back to 4.7.9 makes everything work in e107
|
||||
* Issue #3136
|
||||
*/
|
||||
e107::js('footer', 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.9/tinymce.min.js');
|
||||
|
||||
|
||||
// e107::js('footer', "//cdn.tinymce.com/4/tinymce.min.js");
|
||||
|
||||
@@ -180,4 +188,4 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -1,8 +1,11 @@
|
||||
tinymce.addI18n('en_GB',{
|
||||
"Cut": "Cut",
|
||||
"Heading 5": "Heading 5",
|
||||
"Header 2": "Header 2",
|
||||
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.",
|
||||
"Heading 4": "Heading 4",
|
||||
"Div": "Div",
|
||||
"Heading 2": "Heading 2",
|
||||
"Paste": "Paste",
|
||||
"Close": "Close",
|
||||
"Font Family": "Font Family",
|
||||
@@ -11,6 +14,8 @@ tinymce.addI18n('en_GB',{
|
||||
"New document": "New document",
|
||||
"Blockquote": "Blockquote",
|
||||
"Numbered list": "Numbered list",
|
||||
"Heading 1": "Heading 1",
|
||||
"Headings": "Headings",
|
||||
"Increase indent": "Increase indent",
|
||||
"Formats": "Formats",
|
||||
"Headers": "Headers",
|
||||
@@ -34,6 +39,8 @@ tinymce.addI18n('en_GB',{
|
||||
"Italic": "Italic",
|
||||
"Align center": "Align centre",
|
||||
"Header 5": "Header 5",
|
||||
"Heading 6": "Heading 6",
|
||||
"Heading 3": "Heading 3",
|
||||
"Decrease indent": "Decrease indent",
|
||||
"Header 4": "Header 4",
|
||||
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",
|
||||
@@ -53,12 +60,20 @@ tinymce.addI18n('en_GB',{
|
||||
"Upper Alpha": "Upper Alpha",
|
||||
"Upper Roman": "Upper Roman",
|
||||
"Lower Roman": "Lower Roman",
|
||||
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.",
|
||||
"Name": "Name",
|
||||
"Anchor": "Anchor",
|
||||
"Id": "ID",
|
||||
"You have unsaved changes are you sure you want to navigate away?": "You have unsaved changes are you sure you want to navigate away?",
|
||||
"Restore last draft": "Restore last draft",
|
||||
"Special character": "Special character",
|
||||
"Source code": "Source code",
|
||||
"Language": "Language",
|
||||
"Insert\/Edit code sample": "Insert\/Edit code sample",
|
||||
"B": "B",
|
||||
"R": "R",
|
||||
"G": "G",
|
||||
"Color": "Colour",
|
||||
"Right to left": "Right to left",
|
||||
"Left to right": "Left to right",
|
||||
"Emoticons": "Emoticons",
|
||||
@@ -83,23 +98,48 @@ tinymce.addI18n('en_GB',{
|
||||
"Style": "Style",
|
||||
"Dimensions": "Dimensions",
|
||||
"Insert image": "Insert image",
|
||||
"Image": "Image",
|
||||
"Zoom in": "Zoom in",
|
||||
"Contrast": "Contrast",
|
||||
"Back": "Back",
|
||||
"Gamma": "Gamma",
|
||||
"Flip horizontally": "Flip horizontally",
|
||||
"Resize": "Resize",
|
||||
"Sharpen": "Sharpen",
|
||||
"Zoom out": "Zoom out",
|
||||
"Image options": "Image options",
|
||||
"Apply": "Apply",
|
||||
"Brightness": "Brightness",
|
||||
"Rotate clockwise": "Rotate clockwise",
|
||||
"Rotate counterclockwise": "Rotate counterclockwise",
|
||||
"Edit image": "Edit image",
|
||||
"Color levels": "Colour levels",
|
||||
"Crop": "Crop",
|
||||
"Orientation": "Orientation",
|
||||
"Flip vertically": "Flip vertically",
|
||||
"Invert": "Invert",
|
||||
"Date\/time": "Date\/time",
|
||||
"Insert date\/time": "Insert date\/time",
|
||||
"Remove link": "Remove link",
|
||||
"Url": "URL",
|
||||
"Text to display": "Text to display",
|
||||
"Anchors": "Anchors",
|
||||
"Insert link": "Insert link",
|
||||
"Link": "Link",
|
||||
"New window": "New window",
|
||||
"None": "None",
|
||||
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?",
|
||||
"Paste or type a link": "Paste or type a link",
|
||||
"Target": "Target",
|
||||
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",
|
||||
"Insert\/edit link": "Insert\/edit link",
|
||||
"Insert\/edit video": "Insert\/edit video",
|
||||
"Poster": "Poster",
|
||||
"Media": "Media",
|
||||
"Alternative source": "Alternative source",
|
||||
"Paste your embed code below:": "Paste your embed code below:",
|
||||
"Insert video": "Insert video",
|
||||
"Poster": "Poster",
|
||||
"Insert\/edit media": "Insert\/edit media",
|
||||
"Embed": "Embed",
|
||||
"Nonbreaking space": "Non-breaking space",
|
||||
"Page break": "Page break",
|
||||
@@ -121,11 +161,13 @@ tinymce.addI18n('en_GB',{
|
||||
"Finish": "Finish",
|
||||
"Ignore all": "Ignore all",
|
||||
"Ignore": "Ignore",
|
||||
"Add to Dictionary": "Add to Dictionary",
|
||||
"Insert row before": "Insert row before",
|
||||
"Rows": "Rows",
|
||||
"Height": "Height",
|
||||
"Paste row after": "Paste row after",
|
||||
"Alignment": "Alignment",
|
||||
"Border color": "Border colour",
|
||||
"Column group": "Column group",
|
||||
"Row": "Row",
|
||||
"Insert column before": "Insert column before",
|
||||
@@ -141,15 +183,20 @@ tinymce.addI18n('en_GB',{
|
||||
"Paste row before": "Paste row before",
|
||||
"Scope": "Scope",
|
||||
"Delete table": "Delete table",
|
||||
"H Align": "H Align",
|
||||
"Top": "Top",
|
||||
"Header cell": "Header cell",
|
||||
"Column": "Column",
|
||||
"Row group": "Row group",
|
||||
"Cell": "Cell",
|
||||
"Header": "Header",
|
||||
"Middle": "Middle",
|
||||
"Cell type": "Cell type",
|
||||
"Copy row": "Copy row",
|
||||
"Row properties": "Row properties",
|
||||
"Table properties": "Table properties",
|
||||
"Row group": "Row group",
|
||||
"Bottom": "Bottom",
|
||||
"V Align": "V Align",
|
||||
"Header": "Header",
|
||||
"Right": "Right",
|
||||
"Insert column after": "Insert column after",
|
||||
"Cols": "Cols",
|
||||
@@ -164,7 +211,11 @@ tinymce.addI18n('en_GB',{
|
||||
"Insert template": "Insert template",
|
||||
"Templates": "Templates",
|
||||
"Background color": "Background colour",
|
||||
"Custom...": "Custom...",
|
||||
"Custom color": "Custom colour",
|
||||
"No color": "No colour",
|
||||
"Text color": "Text colour",
|
||||
"Table of Contents": "Table of Contents",
|
||||
"Show blocks": "Show blocks",
|
||||
"Show invisible characters": "Show invisible characters",
|
||||
"Words: {0}": "Words: {0}",
|
@@ -1,123 +1,101 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
(function () {
|
||||
var bbcode = (function () {
|
||||
'use strict';
|
||||
|
||||
/*global tinymce:true */
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.BBCodePlugin', {
|
||||
init : function(ed) {
|
||||
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
ed.on('beforeSetContent', function(e) {
|
||||
e.content = t['_' + dialect + '_bbcode2html'](e.content);
|
||||
});
|
||||
var html2bbcode = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, '[url=$1]$2[/url]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, '[size=$1]$2[/size]');
|
||||
rep(/<font>(.*?)<\/font>/gi, '$1');
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, '[img]$1[/img]');
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, '[code]$1[/code]');
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, '[quote]$1[/quote]');
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]');
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]');
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, '[code][i]$1[/i][/code]');
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]');
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, '[code][u]$1[/u][/code]');
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]');
|
||||
rep(/<\/(strong|b)>/gi, '[/b]');
|
||||
rep(/<(strong|b)>/gi, '[b]');
|
||||
rep(/<\/(em|i)>/gi, '[/i]');
|
||||
rep(/<(em|i)>/gi, '[i]');
|
||||
rep(/<\/u>/gi, '[/u]');
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, '[u]$1[/u]');
|
||||
rep(/<u>/gi, '[u]');
|
||||
rep(/<blockquote[^>]*>/gi, '[quote]');
|
||||
rep(/<\/blockquote>/gi, '[/quote]');
|
||||
rep(/<br \/>/gi, '\n');
|
||||
rep(/<br\/>/gi, '\n');
|
||||
rep(/<br>/gi, '\n');
|
||||
rep(/<p>/gi, '');
|
||||
rep(/<\/p>/gi, '\n');
|
||||
rep(/ |\u00a0/gi, ' ');
|
||||
rep(/"/gi, '"');
|
||||
rep(/</gi, '<');
|
||||
rep(/>/gi, '>');
|
||||
rep(/&/gi, '&');
|
||||
return s;
|
||||
};
|
||||
var bbcode2html = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/\n/gi, '<br />');
|
||||
rep(/\[b\]/gi, '<strong>');
|
||||
rep(/\[\/b\]/gi, '</strong>');
|
||||
rep(/\[i\]/gi, '<em>');
|
||||
rep(/\[\/i\]/gi, '</em>');
|
||||
rep(/\[u\]/gi, '<u>');
|
||||
rep(/\[\/u\]/gi, '</u>');
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>');
|
||||
rep(/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>');
|
||||
rep(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />');
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '<font color="$1">$2</font>');
|
||||
rep(/\[code\](.*?)\[\/code\]/gi, '<span class="codeStyle">$1</span> ');
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '<span class="quoteStyle">$1</span> ');
|
||||
return s;
|
||||
};
|
||||
var $_36akuw96jgqkwz4e = {
|
||||
html2bbcode: html2bbcode,
|
||||
bbcode2html: bbcode2html
|
||||
};
|
||||
|
||||
ed.on('postProcess', function(e) {
|
||||
if (e.set) {
|
||||
e.content = t['_' + dialect + '_bbcode2html'](e.content);
|
||||
}
|
||||
global.add('bbcode', function () {
|
||||
return {
|
||||
init: function (editor) {
|
||||
editor.on('beforeSetContent', function (e) {
|
||||
e.content = $_36akuw96jgqkwz4e.bbcode2html(e.content);
|
||||
});
|
||||
editor.on('postProcess', function (e) {
|
||||
if (e.set) {
|
||||
e.content = $_36akuw96jgqkwz4e.bbcode2html(e.content);
|
||||
}
|
||||
if (e.get) {
|
||||
e.content = $_36akuw96jgqkwz4e.html2bbcode(e.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
if (e.get) {
|
||||
e.content = t['_' + dialect + '_html2bbcode'](e.content);
|
||||
}
|
||||
});
|
||||
},
|
||||
return Plugin;
|
||||
|
||||
getInfo: function() {
|
||||
return {
|
||||
longname: 'BBCode Plugin',
|
||||
author: 'Moxiecode Systems AB',
|
||||
authorurl: 'http://www.tinymce.com',
|
||||
infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode'
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
// HTML -> BBCode in PunBB dialect
|
||||
_punbb_html2bbcode : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: <strong> to [b]
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
|
||||
rep(/<font>(.*?)<\/font>/gi,"$1");
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
|
||||
rep(/<\/(strong|b)>/gi,"[/b]");
|
||||
rep(/<(strong|b)>/gi,"[b]");
|
||||
rep(/<\/(em|i)>/gi,"[/i]");
|
||||
rep(/<(em|i)>/gi,"[i]");
|
||||
rep(/<\/u>/gi,"[/u]");
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");
|
||||
rep(/<u>/gi,"[u]");
|
||||
rep(/<blockquote[^>]*>/gi,"[quote]");
|
||||
rep(/<\/blockquote>/gi,"[/quote]");
|
||||
rep(/<br \/>/gi,"\n");
|
||||
rep(/<br\/>/gi,"\n");
|
||||
rep(/<br>/gi,"\n");
|
||||
rep(/<p>/gi,"");
|
||||
rep(/<\/p>/gi,"\n");
|
||||
rep(/ |\u00a0/gi," ");
|
||||
rep(/"/gi,"\"");
|
||||
rep(/</gi,"<");
|
||||
rep(/>/gi,">");
|
||||
rep(/&/gi,"&");
|
||||
|
||||
return s;
|
||||
},
|
||||
|
||||
// BBCode -> HTML from PunBB dialect
|
||||
_punbb_bbcode2html : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: [b] to <strong>
|
||||
rep(/\n/gi,"<br />");
|
||||
rep(/\[b\]/gi,"<strong>");
|
||||
rep(/\[\/b\]/gi,"</strong>");
|
||||
rep(/\[i\]/gi,"<em>");
|
||||
rep(/\[\/i\]/gi,"</em>");
|
||||
rep(/\[u\]/gi,"<u>");
|
||||
rep(/\[\/u\]/gi,"</u>");
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
|
||||
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
|
||||
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
|
||||
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
|
||||
|
||||
return s;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
|
||||
})();
|
||||
}());
|
||||
})();
|
||||
|
@@ -1 +1 @@
|
||||
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e){var t=this,n=e.getParam("bbcode_dialect","punbb").toLowerCase();e.on("beforeSetContent",function(e){e.content=t["_"+n+"_bbcode2html"](e.content)}),e.on("postProcess",function(e){e.set&&(e.content=t["_"+n+"_bbcode2html"](e.content)),e.get&&(e.content=t["_"+n+"_html2bbcode"](e.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),t(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),t(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),t(/<font>(.*?)<\/font>/gi,"$1"),t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),t(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),t(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),t(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),t(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),t(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),t(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),t(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),t(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),t(/<\/(strong|b)>/gi,"[/b]"),t(/<(strong|b)>/gi,"[b]"),t(/<\/(em|i)>/gi,"[/i]"),t(/<(em|i)>/gi,"[i]"),t(/<\/u>/gi,"[/u]"),t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),t(/<u>/gi,"[u]"),t(/<blockquote[^>]*>/gi,"[quote]"),t(/<\/blockquote>/gi,"[/quote]"),t(/<br \/>/gi,"\n"),t(/<br\/>/gi,"\n"),t(/<br>/gi,"\n"),t(/<p>/gi,""),t(/<\/p>/gi,"\n"),t(/ |\u00a0/gi," "),t(/"/gi,'"'),t(/</gi,"<"),t(/>/gi,">"),t(/&/gi,"&"),e},_punbb_bbcode2html:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/\n/gi,"<br />"),t(/\[b\]/gi,"<strong>"),t(/\[\/b\]/gi,"</strong>"),t(/\[i\]/gi,"<em>"),t(/\[\/i\]/gi,"</em>"),t(/\[u\]/gi,"<u>"),t(/\[\/u\]/gi,"</u>"),t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),t(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),t(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();
|
||||
!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/ |\u00a0/gi," "),o(/"/gi,'"'),o(/</gi,"<"),o(/>/gi,">"),o(/&/gi,"&"),e},i=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}();
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -19,279 +19,304 @@
|
||||
* - No editor.onEvent
|
||||
* - Can't cancel execCommands with beforeExecCommand
|
||||
*/
|
||||
(function(tinymce) {
|
||||
var reported;
|
||||
(function (tinymce) {
|
||||
var reported;
|
||||
|
||||
function noop() {
|
||||
}
|
||||
function noop() {
|
||||
}
|
||||
|
||||
function log(apiCall) {
|
||||
if (!reported && window && window.console) {
|
||||
reported = true;
|
||||
console.log("Deprecated TinyMCE API call: " + apiCall);
|
||||
}
|
||||
}
|
||||
function log(apiCall) {
|
||||
if (!reported && window && window.console) {
|
||||
reported = true;
|
||||
console.log("Deprecated TinyMCE API call: " + apiCall);
|
||||
}
|
||||
}
|
||||
|
||||
function Dispatcher(target, newEventName, argsMap, defaultScope) {
|
||||
target = target || this;
|
||||
function Dispatcher(target, newEventName, argsMap, defaultScope) {
|
||||
target = target || this;
|
||||
var cbs = [];
|
||||
|
||||
if (!newEventName) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = noop;
|
||||
return;
|
||||
}
|
||||
if (!newEventName) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = noop;
|
||||
return;
|
||||
}
|
||||
|
||||
this.add = function(callback, scope, prepend) {
|
||||
log('<target>.on' + newEventName + ".add(..)");
|
||||
this.add = function (callback, scope, prepend) {
|
||||
log('<target>.on' + newEventName + ".add(..)");
|
||||
|
||||
// Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
|
||||
function patchedEventCallback(e) {
|
||||
var callbackArgs = [];
|
||||
// Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
|
||||
function patchedEventCallback(e) {
|
||||
var callbackArgs = [];
|
||||
|
||||
if (typeof argsMap == "string") {
|
||||
argsMap = argsMap.split(" ");
|
||||
}
|
||||
if (typeof argsMap == "string") {
|
||||
argsMap = argsMap.split(" ");
|
||||
}
|
||||
|
||||
if (argsMap && typeof argsMap != "function") {
|
||||
for (var i = 0; i < argsMap.length; i++) {
|
||||
callbackArgs.push(e[argsMap[i]]);
|
||||
}
|
||||
}
|
||||
if (argsMap && typeof argsMap !== "function") {
|
||||
for (var i = 0; i < argsMap.length; i++) {
|
||||
callbackArgs.push(e[argsMap[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof argsMap == "function") {
|
||||
callbackArgs = argsMap(newEventName, e, target);
|
||||
if (!callbackArgs) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (typeof argsMap == "function") {
|
||||
callbackArgs = argsMap(newEventName, e, target);
|
||||
if (!callbackArgs) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!argsMap) {
|
||||
callbackArgs = [e];
|
||||
}
|
||||
if (!argsMap) {
|
||||
callbackArgs = [e];
|
||||
}
|
||||
|
||||
callbackArgs.unshift(defaultScope || target);
|
||||
callbackArgs.unshift(defaultScope || target);
|
||||
|
||||
if (callback.apply(scope || defaultScope || target, callbackArgs) === false) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
if (callback.apply(scope || defaultScope || target, callbackArgs) === false) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
|
||||
target.on(newEventName, patchedEventCallback, prepend);
|
||||
target.on(newEventName, patchedEventCallback, prepend);
|
||||
|
||||
return patchedEventCallback;
|
||||
};
|
||||
var handlers = {
|
||||
original: callback,
|
||||
patched: patchedEventCallback
|
||||
};
|
||||
|
||||
this.addToTop = function(callback, scope) {
|
||||
this.add(callback, scope, true);
|
||||
};
|
||||
cbs.push(handlers);
|
||||
return patchedEventCallback;
|
||||
};
|
||||
|
||||
this.remove = function(callback) {
|
||||
return target.off(newEventName, callback);
|
||||
};
|
||||
this.addToTop = function (callback, scope) {
|
||||
this.add(callback, scope, true);
|
||||
};
|
||||
|
||||
this.dispatch = function() {
|
||||
target.fire(newEventName);
|
||||
this.remove = function (callback) {
|
||||
cbs.forEach(function (item, i) {
|
||||
if (item.original === callback) {
|
||||
cbs.splice(i, 1);
|
||||
return target.off(newEventName, item.patched);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
return target.off(newEventName, callback);
|
||||
};
|
||||
|
||||
tinymce.util.Dispatcher = Dispatcher;
|
||||
tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload");
|
||||
tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
|
||||
tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
|
||||
this.dispatch = function () {
|
||||
target.fire(newEventName);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.util.Cookie = {
|
||||
get: noop, getHash: noop, remove: noop, set: noop, setHash: noop
|
||||
};
|
||||
tinymce.util.Dispatcher = Dispatcher;
|
||||
tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload");
|
||||
tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
|
||||
tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
|
||||
|
||||
function patchEditor(editor) {
|
||||
function patchEditorEvents(oldEventNames, argsMap) {
|
||||
tinymce.each(oldEventNames.split(" "), function(oldName) {
|
||||
editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
|
||||
});
|
||||
}
|
||||
tinymce.util.Cookie = {
|
||||
get: noop, getHash: noop, remove: noop, set: noop, setHash: noop
|
||||
};
|
||||
|
||||
function convertUndoEventArgs(type, event, target) {
|
||||
return [
|
||||
event.level,
|
||||
target
|
||||
];
|
||||
}
|
||||
function patchEditor(editor) {
|
||||
|
||||
function filterSelectionEvents(needsSelection) {
|
||||
return function(type, e) {
|
||||
if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
|
||||
return [e];
|
||||
}
|
||||
};
|
||||
}
|
||||
function translate(str) {
|
||||
var prefix = editor.settings.language || "en";
|
||||
var prefixedStr = [prefix, str].join('.');
|
||||
var translatedStr = tinymce.i18n.translate(prefixedStr);
|
||||
|
||||
if (editor.controlManager) {
|
||||
return;
|
||||
}
|
||||
return prefixedStr !== translatedStr ? translatedStr : tinymce.i18n.translate(str);
|
||||
}
|
||||
|
||||
function cmNoop() {
|
||||
var obj = {}, methods = 'add addMenu addSeparator collapse createMenu destroy displayColor expand focus ' +
|
||||
'getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark ' +
|
||||
'postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex ' +
|
||||
'setActive setAriaProperty setColor setDisabled setSelected setState showMenu update';
|
||||
function patchEditorEvents(oldEventNames, argsMap) {
|
||||
tinymce.each(oldEventNames.split(" "), function (oldName) {
|
||||
editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
|
||||
});
|
||||
}
|
||||
|
||||
log('editor.controlManager.*');
|
||||
function convertUndoEventArgs(type, event, target) {
|
||||
return [
|
||||
event.level,
|
||||
target
|
||||
];
|
||||
}
|
||||
|
||||
function _noop() {
|
||||
return cmNoop();
|
||||
}
|
||||
function filterSelectionEvents(needsSelection) {
|
||||
return function (type, e) {
|
||||
if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
|
||||
return [e];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.each(methods.split(' '), function(method) {
|
||||
obj[method] = _noop;
|
||||
});
|
||||
if (editor.controlManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
function cmNoop() {
|
||||
var obj = {}, methods = 'add addMenu addSeparator collapse createMenu destroy displayColor expand focus ' +
|
||||
'getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark ' +
|
||||
'postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex ' +
|
||||
'setActive setAriaProperty setColor setDisabled setSelected setState showMenu update';
|
||||
|
||||
editor.controlManager = {
|
||||
buttons: {},
|
||||
log('editor.controlManager.*');
|
||||
|
||||
setDisabled: function(name, state) {
|
||||
log("controlManager.setDisabled(..)");
|
||||
function _noop() {
|
||||
return cmNoop();
|
||||
}
|
||||
|
||||
if (this.buttons[name]) {
|
||||
this.buttons[name].disabled(state);
|
||||
}
|
||||
},
|
||||
tinymce.each(methods.split(' '), function (method) {
|
||||
obj[method] = _noop;
|
||||
});
|
||||
|
||||
setActive: function(name, state) {
|
||||
log("controlManager.setActive(..)");
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (this.buttons[name]) {
|
||||
this.buttons[name].active(state);
|
||||
}
|
||||
},
|
||||
editor.controlManager = {
|
||||
buttons: {},
|
||||
|
||||
onAdd: new Dispatcher(),
|
||||
onPostRender: new Dispatcher(),
|
||||
setDisabled: function (name, state) {
|
||||
log("controlManager.setDisabled(..)");
|
||||
|
||||
add: function(obj) {
|
||||
return obj;
|
||||
},
|
||||
createButton: cmNoop,
|
||||
createColorSplitButton: cmNoop,
|
||||
createControl: cmNoop,
|
||||
createDropMenu: cmNoop,
|
||||
createListBox: cmNoop,
|
||||
createMenuButton: cmNoop,
|
||||
createSeparator: cmNoop,
|
||||
createSplitButton: cmNoop,
|
||||
createToolbar: cmNoop,
|
||||
createToolbarGroup: cmNoop,
|
||||
destroy: noop,
|
||||
get: noop,
|
||||
setControlType: cmNoop
|
||||
};
|
||||
if (this.buttons[name]) {
|
||||
this.buttons[name].disabled(state);
|
||||
}
|
||||
},
|
||||
|
||||
patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor");
|
||||
patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset");
|
||||
patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported
|
||||
patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change");
|
||||
patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false));
|
||||
patchEditorEvents("SetProgressState", "state time");
|
||||
patchEditorEvents("VisualAid", "element hasVisual");
|
||||
patchEditorEvents("Undo Redo", convertUndoEventArgs);
|
||||
setActive: function (name, state) {
|
||||
log("controlManager.setActive(..)");
|
||||
|
||||
patchEditorEvents("NodeChange", function(type, e) {
|
||||
return [
|
||||
editor.controlManager,
|
||||
e.element,
|
||||
editor.selection.isCollapsed(),
|
||||
e
|
||||
];
|
||||
});
|
||||
if (this.buttons[name]) {
|
||||
this.buttons[name].active(state);
|
||||
}
|
||||
},
|
||||
|
||||
var originalAddButton = editor.addButton;
|
||||
editor.addButton = function(name, settings) {
|
||||
var originalOnPostRender;
|
||||
onAdd: new Dispatcher(),
|
||||
onPostRender: new Dispatcher(),
|
||||
|
||||
function patchedPostRender() {
|
||||
editor.controlManager.buttons[name] = this;
|
||||
add: function (obj) {
|
||||
return obj;
|
||||
},
|
||||
createButton: cmNoop,
|
||||
createColorSplitButton: cmNoop,
|
||||
createControl: cmNoop,
|
||||
createDropMenu: cmNoop,
|
||||
createListBox: cmNoop,
|
||||
createMenuButton: cmNoop,
|
||||
createSeparator: cmNoop,
|
||||
createSplitButton: cmNoop,
|
||||
createToolbar: cmNoop,
|
||||
createToolbarGroup: cmNoop,
|
||||
destroy: noop,
|
||||
get: noop,
|
||||
setControlType: cmNoop
|
||||
};
|
||||
|
||||
if (originalOnPostRender) {
|
||||
return originalOnPostRender.call(this);
|
||||
}
|
||||
}
|
||||
patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor");
|
||||
patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset");
|
||||
patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported
|
||||
patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change");
|
||||
patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false));
|
||||
patchEditorEvents("SetProgressState", "state time");
|
||||
patchEditorEvents("VisualAid", "element hasVisual");
|
||||
patchEditorEvents("Undo Redo", convertUndoEventArgs);
|
||||
|
||||
for (var key in settings) {
|
||||
if (key.toLowerCase() === "onpostrender") {
|
||||
originalOnPostRender = settings[key];
|
||||
settings.onPostRender = patchedPostRender;
|
||||
}
|
||||
}
|
||||
patchEditorEvents("NodeChange", function (type, e) {
|
||||
return [
|
||||
editor.controlManager,
|
||||
e.element,
|
||||
editor.selection.isCollapsed(),
|
||||
e
|
||||
];
|
||||
});
|
||||
|
||||
if (!originalOnPostRender) {
|
||||
settings.onPostRender = patchedPostRender;
|
||||
}
|
||||
var originalAddButton = editor.addButton;
|
||||
editor.addButton = function (name, settings) {
|
||||
var originalOnPostRender;
|
||||
|
||||
if (settings.title) {
|
||||
settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title);
|
||||
}
|
||||
function patchedPostRender() {
|
||||
editor.controlManager.buttons[name] = this;
|
||||
|
||||
return originalAddButton.call(this, name, settings);
|
||||
};
|
||||
if (originalOnPostRender) {
|
||||
return originalOnPostRender.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
editor.on('init', function() {
|
||||
var undoManager = editor.undoManager, selection = editor.selection;
|
||||
for (var key in settings) {
|
||||
if (key.toLowerCase() === "onpostrender") {
|
||||
originalOnPostRender = settings[key];
|
||||
settings.onPostRender = patchedPostRender;
|
||||
}
|
||||
}
|
||||
|
||||
undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
|
||||
undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager);
|
||||
undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager);
|
||||
undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager);
|
||||
if (!originalOnPostRender) {
|
||||
settings.onPostRender = patchedPostRender;
|
||||
}
|
||||
|
||||
selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection);
|
||||
selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection);
|
||||
selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection);
|
||||
selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
|
||||
});
|
||||
if (settings.title) {
|
||||
settings.title = translate(settings.title);
|
||||
}
|
||||
|
||||
editor.on('BeforeRenderUI', function() {
|
||||
var windowManager = editor.windowManager;
|
||||
return originalAddButton.call(this, name, settings);
|
||||
};
|
||||
|
||||
windowManager.onOpen = new Dispatcher();
|
||||
windowManager.onClose = new Dispatcher();
|
||||
windowManager.createInstance = function(className, a, b, c, d, e) {
|
||||
log("windowManager.createInstance(..)");
|
||||
editor.on('init', function () {
|
||||
var undoManager = editor.undoManager, selection = editor.selection;
|
||||
|
||||
var constr = tinymce.resolve(className);
|
||||
return new constr(a, b, c, d, e);
|
||||
};
|
||||
});
|
||||
}
|
||||
undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
|
||||
undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager);
|
||||
undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager);
|
||||
undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager);
|
||||
|
||||
tinymce.on('SetupEditor', patchEditor);
|
||||
tinymce.PluginManager.add("compat3x", patchEditor);
|
||||
selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection);
|
||||
selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection);
|
||||
selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection);
|
||||
selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
|
||||
});
|
||||
|
||||
tinymce.addI18n = function(prefix, o) {
|
||||
var I18n = tinymce.util.I18n, each = tinymce.each;
|
||||
editor.on('BeforeRenderUI', function () {
|
||||
var windowManager = editor.windowManager;
|
||||
|
||||
if (typeof prefix == "string" && prefix.indexOf('.') === -1) {
|
||||
I18n.add(prefix, o);
|
||||
return;
|
||||
}
|
||||
windowManager.onOpen = new Dispatcher();
|
||||
windowManager.onClose = new Dispatcher();
|
||||
windowManager.createInstance = function (className, a, b, c, d, e) {
|
||||
log("windowManager.createInstance(..)");
|
||||
|
||||
if (!tinymce.is(prefix, 'string')) {
|
||||
each(prefix, function(o, lc) {
|
||||
each(o, function(o, g) {
|
||||
each(o, function(o, k) {
|
||||
if (g === 'common') {
|
||||
I18n.data[lc + '.' + k] = o;
|
||||
} else {
|
||||
I18n.data[lc + '.' + g + '.' + k] = o;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
each(o, function(o, k) {
|
||||
I18n.data[prefix + '.' + k] = o;
|
||||
});
|
||||
}
|
||||
};
|
||||
var constr = tinymce.resolve(className);
|
||||
return new constr(a, b, c, d, e);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.on('SetupEditor', function (e) {
|
||||
patchEditor(e.editor);
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add("compat3x", patchEditor);
|
||||
|
||||
tinymce.addI18n = function (prefix, o) {
|
||||
var I18n = tinymce.util.I18n, each = tinymce.each;
|
||||
|
||||
if (typeof prefix == "string" && prefix.indexOf('.') === -1) {
|
||||
I18n.add(prefix, o);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tinymce.is(prefix, 'string')) {
|
||||
each(prefix, function (o, lc) {
|
||||
each(o, function (o, g) {
|
||||
each(o, function (o, k) {
|
||||
if (g === 'common') {
|
||||
I18n.data[lc + '.' + k] = o;
|
||||
} else {
|
||||
I18n.data[lc + '.' + g + '.' + k] = o;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
each(o, function (o, k) {
|
||||
I18n.data[prefix + '.' + k] = o;
|
||||
});
|
||||
}
|
||||
};
|
||||
})(tinymce);
|
||||
|
@@ -1 +1 @@
|
||||
!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g,h){function i(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.on"+d+".add(..)"),a.on(d,i,h),i},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f;for(var g in c)"onpostrender"===g.toLowerCase()&&(f=c[g],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(c.title=a.i18n.translate((e.settings.language||"en")+"."+c.title)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
|
||||
!function(u){var t;function l(){}function f(e){!t&&window&&window.console&&(t=!0,console.log("Deprecated TinyMCE API call: "+e))}function i(i,a,d,s){i=i||this;var c=[];a?(this.add=function(o,r,e){function t(e){var t=[];if("string"==typeof d&&(d=d.split(" ")),d&&"function"!=typeof d)for(var n=0;n<d.length;n++)t.push(e[d[n]]);("function"!=typeof d||(t=d(a,e,i)))&&(d||(t=[e]),t.unshift(s||i),!1===o.apply(r||s||i,t)&&e.stopImmediatePropagation())}f("<target>.on"+a+".add(..)"),i.on(a,t,e);var n={original:o,patched:t};return c.push(n),t},this.addToTop=function(e,t){this.add(e,t,!0)},this.remove=function(n){return c.forEach(function(e,t){if(e.original===n)return c.splice(t,1),i.off(a,e.patched)}),i.off(a,n)},this.dispatch=function(){return i.fire(a),!0}):this.add=this.addToTop=this.remove=this.dispatch=l}function n(s){function e(e,t){u.each(e.split(" "),function(e){s["on"+e]=new i(s,e,t)})}function n(e,t,n){return[t.level,n]}function o(n){return function(e,t){if(!t.selection&&!n||t.selection==n)return[t]}}if(!s.controlManager){s.controlManager={buttons:{},setDisabled:function(e,t){f("controlManager.setDisabled(..)"),this.buttons[e]&&this.buttons[e].disabled(t)},setActive:function(e,t){f("controlManager.setActive(..)"),this.buttons[e]&&this.buttons[e].active(t)},onAdd:new i,onPostRender:new i,add:function(e){return e},createButton:r,createColorSplitButton:r,createControl:r,createDropMenu:r,createListBox:r,createMenuButton:r,createSeparator:r,createSplitButton:r,createToolbar:r,createToolbarGroup:r,destroy:l,get:l,setControlType:r},e("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),e("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),e("BeforeExecCommand ExecCommand","command ui value args"),e("PreProcess PostProcess LoadContent SaveContent Change"),e("BeforeSetContent BeforeGetContent SetContent GetContent",o(!1)),e("SetProgressState","state time"),e("VisualAid","element hasVisual"),e("Undo Redo",n),e("NodeChange",function(e,t){return[s.controlManager,t.element,s.selection.isCollapsed(),t]});var c=s.addButton;s.addButton=function(e,t){var n,o,r,i;function a(){if(s.controlManager.buttons[e]=this,n)return n.apply(this,arguments)}for(var d in t)"onpostrender"===d.toLowerCase()&&(n=t[d],t.onPostRender=a);return n||(t.onPostRender=a),t.title&&(t.title=(o=t.title,r=[s.settings.language||"en",o].join("."),i=u.i18n.translate(r),r!==i?i:u.i18n.translate(o))),c.call(this,e,t)},s.on("init",function(){var e=s.undoManager,t=s.selection;e.onUndo=new i(s,"Undo",n,null,e),e.onRedo=new i(s,"Redo",n,null,e),e.onBeforeAdd=new i(s,"BeforeAddUndo",null,e),e.onAdd=new i(s,"AddUndo",null,e),t.onBeforeGetContent=new i(s,"BeforeGetContent",o(!0),t),t.onGetContent=new i(s,"GetContent",o(!0),t),t.onBeforeSetContent=new i(s,"BeforeSetContent",o(!0),t),t.onSetContent=new i(s,"SetContent",o(!0),t)}),s.on("BeforeRenderUI",function(){var e=s.windowManager;e.onOpen=new i,e.onClose=new i,e.createInstance=function(e,t,n,o,r,i){return f("windowManager.createInstance(..)"),new(u.resolve(e))(t,n,o,r,i)}})}function r(){var t={};function n(){return r()}return f("editor.controlManager.*"),u.each("add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update".split(" "),function(e){t[e]=n}),t}}u.util.Dispatcher=i,u.onBeforeUnload=new i(u,"BeforeUnload"),u.onAddEditor=new i(u,"AddEditor","editor"),u.onRemoveEditor=new i(u,"RemoveEditor","editor"),u.util.Cookie={get:l,getHash:l,remove:l,set:l,setHash:l},u.on("SetupEditor",function(e){n(e.editor)}),u.PluginManager.add("compat3x",n),u.addI18n=function(n,e){var r=u.util.I18n,t=u.each;"string"!=typeof n||-1!==n.indexOf(".")?u.is(n,"string")?t(e,function(e,t){r.data[n+"."+t]=e}):t(n,function(e,o){t(e,function(e,n){t(e,function(e,t){"common"===n?r.data[o+"."+t]=e:r.data[o+"."+n+"."+t]=e})})}):r.add(n,e)}}(tinymce);
|
1010
e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js
vendored
1010
e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,70 +1,72 @@
|
||||
/**
|
||||
* editable_selects.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
var TinyMCE_EditableSelects = {
|
||||
editSelectElm : null,
|
||||
editSelectElm : null,
|
||||
|
||||
init : function() {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
init : function () {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
||||
|
||||
o.className = 'mceAddSelectValue';
|
||||
o.className = 'mceAddSelectValue';
|
||||
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
|
||||
}
|
||||
}
|
||||
},
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(e) {
|
||||
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
||||
onChangeEditableSelect : function (e) {
|
||||
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
|
||||
ne.style.width = se.offsetWidth + 'px';
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
ne.style.width = se.offsetWidth + 'px';
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
onBlurEditableSelectInput : function () {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else {
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
}
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
},
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown : function(e) {
|
||||
e = e || window.event;
|
||||
onKeyDown : function (e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13)
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
if (e.keyCode == 13) {
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* form_utils.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -11,200 +11,212 @@
|
||||
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
|
||||
|
||||
function getColorPickerHTML(id, target_form_element) {
|
||||
var h = "", dom = tinyMCEPopup.dom;
|
||||
var h = "", dom = tinyMCEPopup.dom;
|
||||
|
||||
if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
|
||||
label.id = label.id || dom.uniqueId();
|
||||
}
|
||||
if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
|
||||
label.id = label.id || dom.uniqueId();
|
||||
}
|
||||
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element + '\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
||||
|
||||
return h;
|
||||
return h;
|
||||
}
|
||||
|
||||
function updateColor(img_id, form_element_id) {
|
||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||
}
|
||||
|
||||
function setBrowserDisabled(id, state) {
|
||||
var img = document.getElementById(id);
|
||||
var lnk = document.getElementById(id + "_link");
|
||||
var img = document.getElementById(id);
|
||||
var lnk = document.getElementById(id + "_link");
|
||||
|
||||
if (lnk) {
|
||||
if (state) {
|
||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCEPopup.dom.addClass(img, 'disabled');
|
||||
} else {
|
||||
if (lnk.getAttribute("realhref"))
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
if (lnk) {
|
||||
if (state) {
|
||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCEPopup.dom.addClass(img, 'disabled');
|
||||
} else {
|
||||
if (lnk.getAttribute("realhref")) {
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
}
|
||||
|
||||
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
||||
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
return "";
|
||||
if (!cb) {
|
||||
return "";
|
||||
}
|
||||
|
||||
html = "";
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>';
|
||||
html = "";
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>';
|
||||
|
||||
return html;
|
||||
return html;
|
||||
}
|
||||
|
||||
function openBrowser(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
if (img.className != "mceButtonDisabled") {
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
return;
|
||||
if (!form_obj || !form_obj.elements[field_name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
value = "";
|
||||
if (!value) {
|
||||
value = "";
|
||||
}
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<sel.options.length; i++) {
|
||||
var option = sel.options[i];
|
||||
var found = false;
|
||||
for (var i = 0; i < sel.options.length; i++) {
|
||||
var option = sel.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else
|
||||
option.selected = false;
|
||||
}
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else {
|
||||
option.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
return found;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
||||
return "";
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addSelectValue(form_obj, field_name, name, value) {
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
}
|
||||
|
||||
function addClassesToList(list_id, specific_option) {
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCEPopup.getParam(specific_option, styles);
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCEPopup.getParam(specific_option, styles);
|
||||
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
for (var i = 0; i < stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
|
||||
});*/
|
||||
}
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
||||
function isVisible(element_id) {
|
||||
var elm = document.getElementById(element_id);
|
||||
var elm = document.getElementById(element_id);
|
||||
|
||||
return elm && elm.style.display != "none";
|
||||
return elm && elm.style.display != "none";
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
|
||||
return col;
|
||||
return col;
|
||||
}
|
||||
|
||||
function trimSize(size) {
|
||||
return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
|
||||
return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
|
||||
}
|
||||
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
return "";
|
||||
if (size == "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size))
|
||||
size += 'px';
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
||||
return "";
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size)) {
|
||||
size += 'px';
|
||||
}
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return size;
|
||||
return size;
|
||||
}
|
||||
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
return '' + val;
|
||||
if (val != '') {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
style = attrib;
|
||||
if (typeof (style) == 'undefined') {
|
||||
style = attrib;
|
||||
}
|
||||
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* mctabs.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -11,154 +11,158 @@
|
||||
/*jshint globals: tinyMCEPopup */
|
||||
|
||||
function MCTabs() {
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
}
|
||||
|
||||
MCTabs.prototype.init = function (settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
this.settings = settings;
|
||||
MCTabs.prototype.getParam = function (name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof (this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false") {
|
||||
return (value == "true");
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
return (value == "true");
|
||||
|
||||
return value;
|
||||
MCTabs.prototype.showTab = function (tab) {
|
||||
tab.className = 'current';
|
||||
tab.setAttribute("aria-selected", true);
|
||||
tab.setAttribute("aria-expanded", true);
|
||||
tab.tabIndex = 0;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showTab =function(tab){
|
||||
tab.className = 'current';
|
||||
tab.setAttribute("aria-selected", true);
|
||||
tab.setAttribute("aria-expanded", true);
|
||||
tab.tabIndex = 0;
|
||||
MCTabs.prototype.hideTab = function (tab) {
|
||||
var t = this;
|
||||
|
||||
tab.className = '';
|
||||
tab.setAttribute("aria-selected", false);
|
||||
tab.setAttribute("aria-expanded", false);
|
||||
tab.tabIndex = -1;
|
||||
};
|
||||
|
||||
MCTabs.prototype.hideTab =function(tab){
|
||||
var t=this;
|
||||
|
||||
tab.className = '';
|
||||
tab.setAttribute("aria-selected", false);
|
||||
tab.setAttribute("aria-expanded", false);
|
||||
tab.tabIndex = -1;
|
||||
MCTabs.prototype.showPanel = function (panel) {
|
||||
panel.className = 'current';
|
||||
panel.setAttribute("aria-hidden", false);
|
||||
};
|
||||
|
||||
MCTabs.prototype.showPanel = function(panel) {
|
||||
panel.className = 'current';
|
||||
panel.setAttribute("aria-hidden", false);
|
||||
MCTabs.prototype.hidePanel = function (panel) {
|
||||
panel.className = 'panel';
|
||||
panel.setAttribute("aria-hidden", true);
|
||||
};
|
||||
|
||||
MCTabs.prototype.hidePanel = function(panel) {
|
||||
panel.className = 'panel';
|
||||
panel.setAttribute("aria-hidden", true);
|
||||
};
|
||||
|
||||
MCTabs.prototype.getPanelForTab = function(tabElm) {
|
||||
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
||||
MCTabs.prototype.getPanelForTab = function (tabElm) {
|
||||
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
||||
MCTabs.prototype.displayTab = function (tab_id, panel_id, avoid_focus) {
|
||||
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
||||
|
||||
tabElm = document.getElementById(tab_id);
|
||||
tabElm = document.getElementById(tab_id);
|
||||
|
||||
if (panel_id === undefined) {
|
||||
panel_id = t.getPanelForTab(tabElm);
|
||||
}
|
||||
if (panel_id === undefined) {
|
||||
panel_id = t.getPanelForTab(tabElm);
|
||||
}
|
||||
|
||||
panelElm= document.getElementById(panel_id);
|
||||
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
selectionClass = t.getParam('selection_class', 'current');
|
||||
panelElm = document.getElementById(panel_id);
|
||||
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
selectionClass = t.getParam('selection_class', 'current');
|
||||
|
||||
if (tabElm && tabContainerElm) {
|
||||
nodes = tabContainerElm.childNodes;
|
||||
if (tabElm && tabContainerElm) {
|
||||
nodes = tabContainerElm.childNodes;
|
||||
|
||||
// Hide all other tabs
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI") {
|
||||
t.hideTab(nodes[i]);
|
||||
}
|
||||
}
|
||||
// Hide all other tabs
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI") {
|
||||
t.hideTab(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Show selected tab
|
||||
t.showTab(tabElm);
|
||||
}
|
||||
// Show selected tab
|
||||
t.showTab(tabElm);
|
||||
}
|
||||
|
||||
if (panelElm && panelContainerElm) {
|
||||
nodes = panelContainerElm.childNodes;
|
||||
if (panelElm && panelContainerElm) {
|
||||
nodes = panelContainerElm.childNodes;
|
||||
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV") {
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
}
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
}
|
||||
|
||||
// Show selected panel
|
||||
t.showPanel(panelElm);
|
||||
}
|
||||
// Show selected panel
|
||||
t.showPanel(panelElm);
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
var pos, url = document.location.href;
|
||||
MCTabs.prototype.getAnchor = function () {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
return url.substring(pos + 1);
|
||||
if ((pos = url.lastIndexOf('#')) != -1) {
|
||||
return url.substring(pos + 1);
|
||||
}
|
||||
|
||||
return "";
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
//Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
||||
tinyMCEPopup.onInit.add(function () {
|
||||
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
||||
|
||||
each(dom.select('div.tabs'), function(tabContainerElm) {
|
||||
//var keyNav;
|
||||
each(dom.select('div.tabs'), function (tabContainerElm) {
|
||||
//var keyNav;
|
||||
|
||||
dom.setAttrib(tabContainerElm, "role", "tablist");
|
||||
dom.setAttrib(tabContainerElm, "role", "tablist");
|
||||
|
||||
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
||||
var action = function(id) {
|
||||
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
||||
mcTabs.onChange.dispatch(id);
|
||||
};
|
||||
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
||||
var action = function (id) {
|
||||
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
||||
mcTabs.onChange.dispatch(id);
|
||||
};
|
||||
|
||||
each(items, function(item) {
|
||||
dom.setAttrib(item, 'role', 'tab');
|
||||
dom.bind(item, 'click', function(evt) {
|
||||
action(item.id);
|
||||
});
|
||||
});
|
||||
each(items, function (item) {
|
||||
dom.setAttrib(item, 'role', 'tab');
|
||||
dom.bind(item, 'click', function (evt) {
|
||||
action(item.id);
|
||||
});
|
||||
});
|
||||
|
||||
dom.bind(dom.getRoot(), 'keydown', function(evt) {
|
||||
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
||||
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
||||
tinymce.dom.Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
dom.bind(dom.getRoot(), 'keydown', function (evt) {
|
||||
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
||||
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
||||
tinymce.dom.Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
|
||||
each(dom.select('a', tabContainerElm), function(a) {
|
||||
dom.setAttrib(a, 'tabindex', '-1');
|
||||
});
|
||||
each(dom.select('a', tabContainerElm), function (a) {
|
||||
dom.setAttrib(a, 'tabindex', '-1');
|
||||
});
|
||||
|
||||
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: tabContainerElm,
|
||||
items: items,
|
||||
onAction: action,
|
||||
actOnFocus: true,
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);*/
|
||||
});
|
||||
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: tabContainerElm,
|
||||
items: items,
|
||||
onAction: action,
|
||||
actOnFocus: true,
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);*/
|
||||
}
|
||||
);
|
||||
});
|
@@ -1,252 +1,267 @@
|
||||
/**
|
||||
* validate.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/**
|
||||
// String validation:
|
||||
// String validation:
|
||||
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
|
||||
// Form validation:
|
||||
// Form validation:
|
||||
|
||||
var f = document.forms['myform'];
|
||||
var f = document.forms['myform'];
|
||||
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
isEmail : function (s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
isAbsUrl : function (s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
|
||||
},
|
||||
isSize : function (s) {
|
||||
return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
isId : function (s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
var nl, i;
|
||||
isEmpty : function (s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
return true;
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
return true;
|
||||
if (s.type == 'checkbox' && !s.checked) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
return false;
|
||||
}
|
||||
if (s.type == 'radio') {
|
||||
for (i = 0, nl = s.form.elements; i < nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
isNumber : function (s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
test : function (s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
};
|
||||
|
||||
var AutoValidator = {
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
var n;
|
||||
init : function (s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
this.settings[n] = s[n];
|
||||
},
|
||||
for (n in s) {
|
||||
this.settings[n] = s[n];
|
||||
}
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
validate : function (f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
nl[i].setAttribute('aria-invalid', false);
|
||||
}
|
||||
nl = this.tags(f, 'label');
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
nl[i].setAttribute('aria-invalid', false);
|
||||
}
|
||||
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
|
||||
return c == 3;
|
||||
},
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
getErrorMessages : function(f) {
|
||||
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (this.hasClass(nl[i], s.invalid_cls)) {
|
||||
field = document.getElementById(nl[i].getAttribute("for"));
|
||||
values = { field: nl[i].textContent };
|
||||
if (this.hasClass(field, s.min_cls, true)) {
|
||||
message = ed.getLang('invalid_data_min');
|
||||
values.min = this.getNum(field, s.min_cls);
|
||||
} else if (this.hasClass(field, s.number_cls)) {
|
||||
message = ed.getLang('invalid_data_number');
|
||||
} else if (this.hasClass(field, s.size_cls)) {
|
||||
message = ed.getLang('invalid_data_size');
|
||||
} else {
|
||||
message = ed.getLang('invalid_data');
|
||||
}
|
||||
|
||||
message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
|
||||
return values[b] || '{#' + b + '}';
|
||||
});
|
||||
messages.push(message);
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
},
|
||||
invalidate : function (n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
getErrorMessages : function (f) {
|
||||
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
|
||||
nl = this.tags(f, "label");
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (this.hasClass(nl[i], s.invalid_cls)) {
|
||||
field = document.getElementById(nl[i].getAttribute("for"));
|
||||
values = { field: nl[i].textContent };
|
||||
if (this.hasClass(field, s.min_cls, true)) {
|
||||
message = ed.getLang('invalid_data_min');
|
||||
values.min = this.getNum(field, s.min_cls);
|
||||
} else if (this.hasClass(field, s.number_cls)) {
|
||||
message = ed.getLang('invalid_data_number');
|
||||
} else if (this.hasClass(field, s.size_cls)) {
|
||||
message = ed.getLang('invalid_data_size');
|
||||
} else {
|
||||
message = ed.getLang('invalid_data');
|
||||
}
|
||||
|
||||
if (e == null)
|
||||
return;
|
||||
message = message.replace(/{\#([^}]+)\}/g, function (a, b) {
|
||||
return values[b] || '{#' + b + '}';
|
||||
});
|
||||
messages.push(message);
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
},
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++) {
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
nl[j].setAttribute('aria-invalid', false);
|
||||
}
|
||||
}
|
||||
},
|
||||
reset : function (e) {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
validateElms : function(f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
n = nl[i];
|
||||
for (i = 0; i < t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j = 0; j < nl.length; j++) {
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
nl[j].setAttribute('aria-invalid', false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
validateElms : function (f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
st = this.mark(f, n);
|
||||
nl = this.tags(f, e);
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
st = this.mark(f, n);
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
st = this.mark(f, n);
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
st = this.mark(f, n);
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
st = this.mark(f, n);
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
st = this.mark(f, n);
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
st = this.mark(f, n);
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
hasClass : function(n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getNum : function(n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
return st;
|
||||
},
|
||||
|
||||
return c;
|
||||
},
|
||||
hasClass : function (n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
|
||||
addClass : function(n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
getNum : function (n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
|
||||
removeClass : function(n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
},
|
||||
return c;
|
||||
},
|
||||
|
||||
tags : function(f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
addClass : function (n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
mark : function(f, n) {
|
||||
var s = this.settings;
|
||||
removeClass : function (n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c !== ' ' ? c : '';
|
||||
},
|
||||
|
||||
this.addClass(n, s.invalid_cls);
|
||||
n.setAttribute('aria-invalid', 'true');
|
||||
this.markLabels(f, n, s.invalid_cls);
|
||||
tags : function (f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
|
||||
return false;
|
||||
},
|
||||
mark : function (f, n) {
|
||||
var s = this.settings;
|
||||
|
||||
markLabels : function(f, n, ic) {
|
||||
var nl, i;
|
||||
this.addClass(n, s.invalid_cls);
|
||||
n.setAttribute('aria-invalid', 'true');
|
||||
this.markLabels(f, n, s.invalid_cls);
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
return null;
|
||||
}
|
||||
markLabels : function (f, n, ic) {
|
||||
var nl, i;
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) {
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@@ -240,7 +240,7 @@ class wysiwyg
|
||||
'Danish' => 'da',
|
||||
// 'Divehi' => 'dv',
|
||||
'Dutch' => 'nl',
|
||||
'English' => 'en', // Default language file.
|
||||
'English' => 'en_GB', // Default language file.
|
||||
// 'English (Canada)' => 'en_CA',
|
||||
// 'English (United Kingdom)' => 'en_GB',
|
||||
'Esperanto' => 'eo',
|
||||
|
@@ -7,7 +7,7 @@ if ( ! defined('e107_INIT')) { exit(); }
|
||||
e107::meta('viewport', 'width=device-width, initial-scale=1.0');
|
||||
//e107::meta('apple-mobile-web-app-capable','yes');
|
||||
|
||||
|
||||
e107::css("url", "https://bootswatch.com/4/slate/bootstrap.min.css" );
|
||||
|
||||
$HEADER = array();
|
||||
$FOOTER = array();
|
||||
|
File diff suppressed because one or more lines are too long
@@ -36,7 +36,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
autoclose: true,
|
||||
format: $item.attr("data-date-format"),
|
||||
weekStart: $item.attr("data-date-firstday"),
|
||||
language: $item.attr("data-date-language")
|
||||
language: $item.attr("data-date-language"),
|
||||
}).on("changeDate", function (ev) {
|
||||
var useUnix = $(this).attr("data-date-unix");
|
||||
var newValue = "";
|
||||
@@ -49,7 +49,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
newValue = $("#" + ev.target.id).val();
|
||||
}
|
||||
|
||||
$(newTarget).val(newValue);
|
||||
$(newTarget).val( newValue);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -62,6 +62,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
weekStart: $item.attr("data-date-firstday"),
|
||||
showMeridian: $item.attr("data-date-ampm"),
|
||||
language: $item.attr("data-date-language")
|
||||
|
||||
}).on("changeDate", function (ev) {
|
||||
var useUnix = $(this).attr("data-date-unix");
|
||||
var newValue = "";
|
||||
@@ -74,7 +75,22 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
newValue = $("#" + ev.target.id).val();
|
||||
}
|
||||
|
||||
offset = parseInt($item.attr("data-date-timezone-offset"));
|
||||
|
||||
if(offset) // adjust UTC value to target timezone. ie. timezone other than the one of the browser.
|
||||
{
|
||||
browserOffset = ev.date.getTimezoneOffset() * 60;
|
||||
relativeOffset = browserOffset + offset;
|
||||
|
||||
console.log("Browser Offset: " + browserOffset);
|
||||
console.log('Offset: ' + offset);
|
||||
console.log('Relative Offset: ' + relativeOffset);
|
||||
|
||||
newValue = newValue - relativeOffset;
|
||||
}
|
||||
|
||||
$(newTarget).val(newValue);
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -351,7 +351,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
{
|
||||
var $button = $(this);
|
||||
var $form = $button.closest('form');
|
||||
|
||||
var form_submited = false;
|
||||
var type = $button.data('loading-icon');
|
||||
|
||||
if(type === undefined || $form.length === 0)
|
||||
@@ -365,6 +365,10 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
return false;
|
||||
}
|
||||
|
||||
if (form_submited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var caption = "<i class='fa fa-spin " + type + " fa-fw'></i>";
|
||||
caption += "<span>" + $button.text() + "</span>";
|
||||
|
||||
@@ -373,6 +377,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
if($button.attr('data-disable') == 'true')
|
||||
{
|
||||
$button.addClass('disabled');
|
||||
form_submited = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -783,6 +788,19 @@ $.ajaxSetup({
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
// Basic Delete Confirmation
|
||||
$('input.delete,button.delete,a[data-confirm]').click(function(){
|
||||
answer = confirm($(this).attr("data-confirm"));
|
||||
return answer; // answer is a boolean
|
||||
});
|
||||
|
||||
$(".e-confirm").click(function(){
|
||||
answer = confirm($(this).attr("title"));
|
||||
return answer; // answer is a boolean
|
||||
});
|
||||
|
||||
|
||||
//check all
|
||||
$("#check-all").click(function(event){
|
||||
var val = $(this).val(), selector = '.field-spacer';
|
||||
|
@@ -201,5 +201,9 @@ jQuery.fn.pwdMeter = function(options){
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})(jQuery)
|
||||
/**
|
||||
* ALLWAYS add a semicolon at the end, otherwise
|
||||
* it may cause issues when js is cached!
|
||||
* see issue e107inc/e107#2265
|
||||
*/
|
||||
})(jQuery);
|
||||
|
@@ -885,6 +885,7 @@ class e_install
|
||||
*/
|
||||
|
||||
$extensionCheck = array(
|
||||
'pdo' => array('label'=> "PDO (MySQL)", 'status' => extension_loaded('pdo_mysql'), 'url'=> ''),
|
||||
'xml' => array('label'=> LANINS_050, 'status' => function_exists('utf8_encode'), 'url'=> 'http://php.net/manual/en/ref.xml.php'),
|
||||
'exif' => array('label'=> LANINS_048, 'status' => function_exists('exif_imagetype'), 'url'=> 'http://php.net/manual/en/book.exif.php'),
|
||||
'curl' => array('label'=> 'Curl Library', 'status' => function_exists('curl_version'), 'url'=> 'http://php.net/manual/en/book.curl.php'),
|
||||
|
@@ -1084,7 +1084,7 @@ if (check_class($search_prefs['google'])) {
|
||||
|
||||
if ($perform_search)
|
||||
{
|
||||
$con = new convert;
|
||||
$con = e107::getDate();
|
||||
|
||||
$sch = new e_search;
|
||||
|
||||
|
@@ -107,7 +107,7 @@ class userUpload
|
||||
$catID = null;
|
||||
$catOwner = null;
|
||||
$file = null;
|
||||
$image = null;
|
||||
$image = '';
|
||||
$filesize = 0;
|
||||
|
||||
|
||||
|
@@ -70,7 +70,8 @@ if ($action == "comments")
|
||||
$sql2 = e107::getDb('sql2');
|
||||
if($user_name)
|
||||
{
|
||||
$ccaption = UP_LAN_1.$user_name;
|
||||
// $ccaption = UP_LAN_1.$user_name;
|
||||
$ccaption = str_replace('[x]', $user_name, UP_LAN_1);
|
||||
/*$sql->db_Select("user", "user_comments", "user_id=".$id);
|
||||
$row = $sql->db_Fetch();
|
||||
$ctotal = $row['user_comments'];*/
|
||||
@@ -159,7 +160,8 @@ elseif ($action == 'forums')
|
||||
exit;
|
||||
}
|
||||
|
||||
$fcaption = UP_LAN_0.' '.$user_name;
|
||||
// $fcaption = UP_LAN_0.' '.$user_name;
|
||||
$fcaption = str_replace('[x]', $user_name, UP_LAN_0);
|
||||
/*
|
||||
if (!$USERPOSTS_FORUM_TABLE)
|
||||
{
|
||||
@@ -312,4 +314,4 @@ function parse_userposts_comments_table($row, $template)
|
||||
return e107::getParser()->simpleParse($template, $vars);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -69,7 +69,7 @@ class usersettings_front // Begin Usersettings rewrite.
|
||||
function __construct()
|
||||
{
|
||||
|
||||
if(deftrue('BOOTSTRAP')===3)
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$template = e107::getCoreTemplate('usersettings','', true, true); // always merge
|
||||
|
||||
@@ -172,6 +172,11 @@ class usersettings_front // Begin Usersettings rewrite.
|
||||
$adminEdit = false; // @deprecated // FALSE if editing own data. TRUE if admin edit
|
||||
|
||||
|
||||
if(!empty($_POST['delete_account']))
|
||||
{
|
||||
echo e107::getMessage()->addWarning("This feature is currently under development. Your data has not been modified")->render(); // do not LAN.
|
||||
}
|
||||
|
||||
/* todo subject of removal */
|
||||
if(is_numeric(e_QUERY))
|
||||
{ // Trying to edit specific user record
|
||||
|
Reference in New Issue
Block a user