mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 21:21:54 +02:00
Make the comments-menu caption support multiple languages.
This commit is contained in:
parent
5f91ebf20d
commit
3afb992fbd
e107_admin
e107_plugins/comment_menu
@ -133,13 +133,18 @@ if (!$dont_check_update)
|
||||
$LAN_UPDATE_5 = deftrue('LAN_UPDATE_5', "Core database structure");
|
||||
|
||||
|
||||
// $dbupdate['212_to_213'] = array('master'=>false, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('2.1.2','2.1.3')), 'message'=> null, 'hide_when_complete'=>true);
|
||||
|
||||
$dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29, 'hide_when_complete'=>false);
|
||||
|
||||
$dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29, 'hide_when_complete'=>true);
|
||||
|
||||
|
||||
// always run these last.
|
||||
$dbupdate['core_database'] = array('master'=>false, 'title'=> $LAN_UPDATE_5);
|
||||
$dbupdate['core_prefs'] = array('master'=>true, 'title'=> LAN_UPDATE_13); // Prefs check
|
||||
|
||||
|
||||
|
||||
// $dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706';
|
||||
} // End if (!$dont_check_update)
|
||||
|
||||
@ -542,7 +547,43 @@ function update_core_database($type = '')
|
||||
return $just_check;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return bool true = no update required, and false if update required.
|
||||
*/
|
||||
function update_212_to_213($type='')
|
||||
{
|
||||
|
||||
$sql = e107::getDb();
|
||||
$log = e107::getLog();
|
||||
$just_check = ($type == 'do') ? false : true;
|
||||
|
||||
// List of changed menu locations.
|
||||
/*
|
||||
$changeMenuPaths = array(
|
||||
|
||||
array('oldpath' => 'comment_menu', 'newpath' => 'comment', 'menu' => 'comment_menu'),
|
||||
);
|
||||
|
||||
if(!empty($changeMenuPaths))
|
||||
{
|
||||
foreach($changeMenuPaths as $val)
|
||||
{
|
||||
$qry = "SELECT menu_path FROM `#menus` WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) LIMIT 1";
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' ');
|
||||
$updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) ";
|
||||
$status = $sql->update('menus', $updqry) ? E_MESSAGE_DEBUG : E_MESSAGE_ERROR;
|
||||
$log->logMessage(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25;
|
||||
// catch_error($sql);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
|
@ -73,5 +73,10 @@ $text .= $tp->parseTemplate($TEMPLATE['end'], true, $comment_menu_shortcodes);
|
||||
|
||||
$title = e107::getConfig('menu')->get('comment_caption');
|
||||
|
||||
if(!empty($title[e_LANGUAGE]))
|
||||
{
|
||||
$title = $title[e_LANGUAGE];
|
||||
}
|
||||
|
||||
e107::getRender()->tablerender(defset($title, $title), $text, 'comment_menu');
|
||||
?>
|
@ -41,8 +41,7 @@ class comment_menu_shortcodes extends e_shortcode
|
||||
|
||||
function sc_cm_datestamp()
|
||||
{
|
||||
$gen = new convert;
|
||||
return $gen->convert_date($this->var['comment_datestamp'], "relative");
|
||||
return e107::getParser()->toDate($this->var['comment_datestamp'], "relative");
|
||||
}
|
||||
|
||||
function sc_cm_heading()
|
||||
|
@ -28,34 +28,57 @@ $menu_config = e107::getConfig('menu');
|
||||
if (isset($_POST['update_menu']))
|
||||
{
|
||||
$temp = $old = $menu_config->getPref();
|
||||
|
||||
|
||||
if(!is_array($temp['comment_caption']))
|
||||
{
|
||||
$temp['comment_caption'] = array();
|
||||
}
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
while (list($key, $value) = each($_POST))
|
||||
{
|
||||
if($key == "comment_caption")
|
||||
{
|
||||
$temp['comment_caption'][e_LANGUAGE] = $tp->toDB($value);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ($value != LAN_UPDATE)
|
||||
{
|
||||
$temp[$tp->toDB($key)] = $tp->toDB($value);
|
||||
}
|
||||
}
|
||||
if (!$_POST['comment_title'])
|
||||
|
||||
if (!$_POST['comment_title'])
|
||||
{
|
||||
$temp['comment_title'] = 0;
|
||||
}
|
||||
|
||||
$menu_config->setPref($temp);
|
||||
if ($admin_log->logArrayDiffs($old, $menu_config->getPref(), 'MISC_04'))
|
||||
|
||||
if($menu_config->save(false))
|
||||
{
|
||||
if($menu_config->save(false))
|
||||
{
|
||||
$mes->addSuccess();
|
||||
}
|
||||
$mes->addSuccess();
|
||||
}
|
||||
/*if ($admin_log->logArrayDiffs($old, $menu_config->getPref(), 'MISC_04'))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addInfo(LAN_NO_CHANGE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
$frm = e107::getForm();
|
||||
|
||||
$commentTmp = $menu_config->get('comment_caption');
|
||||
|
||||
$commentCaption = (!empty($commentTmp[e_LANGUAGE])) ? $commentTmp[e_LANGUAGE] : $commentTmp;
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."' id='plugin-menu-config-form'>
|
||||
<table class='table adminform'>
|
||||
@ -65,7 +88,7 @@ $text = "
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>".CM_L3.":</td>
|
||||
<td><input class='tbox' type='text' name='comment_caption' size='20' value='".$menu_config->get('comment_caption')."' maxlength='100' /></td>
|
||||
<td>".$frm->renderElement('comment_caption',$commentCaption, array('type'=>'text','multilan'=>true))."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user