mirror of
https://github.com/e107inc/e107.git
synced 2025-08-21 21:57:34 +02:00
Merge pull request #4547 from Deltik/fix/4546
Deprecate `e_parse::toJS()`
This commit is contained in:
@@ -373,15 +373,15 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if ($parm == "request")
|
||||
{
|
||||
$agreetext = $tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'));
|
||||
$agreetext = $tp->toAttribute($tp->toJSON($tp->filter($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str')));
|
||||
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm({$agreetext});\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm({$agreetext});\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
}
|
||||
|
||||
$text .= $tp->toHTML($this->var['download_name'], FALSE, 'TITLE')."</a>";
|
||||
@@ -473,7 +473,7 @@ class download_shortcodes extends e_shortcode
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$agreetext = !empty($this->pref['agree_text']) ? $tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION')) : '';
|
||||
$agreetext = !empty($this->pref['agree_text']) ? $tp->toAttribute($tp->toJSON($tp->filter($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str'))) : '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
@@ -493,7 +493,7 @@ class download_shortcodes extends e_shortcode
|
||||
else
|
||||
{
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true, $this); // $this->sc_download_request_url();
|
||||
return (!empty($this->pref['agree_flag']) ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
|
||||
return (!empty($this->pref['agree_flag']) ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm({$agreetext});\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
|
||||
|
||||
// return ($this->pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
|
||||
}
|
||||
@@ -653,7 +653,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if (!empty($this->pref['agree_flag']))
|
||||
{
|
||||
return "<a href='".$url."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
return "<a href='".$url."' onclick= \"return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).");\" title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||
}
|
||||
else
|
||||
@@ -799,7 +799,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if(!empty($this->pref['agree_flag']))
|
||||
{
|
||||
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($this->pref['agree_text'],true,'emotes, no_tags'))."\")'";
|
||||
$click = " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],true,'emotes, no_tags'))).")'";
|
||||
}
|
||||
|
||||
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
|
||||
@@ -955,7 +955,7 @@ class download_shortcodes extends e_shortcode
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$click = !empty($this->pref['agree_text']) ? " onclick='return confirm(\"".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."\")'" : '';
|
||||
$click = !empty($this->pref['agree_text']) ? " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).")'" : '';
|
||||
|
||||
if(defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
|
@@ -410,6 +410,20 @@ $columnInfo = array(
|
||||
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
||||
);
|
||||
|
||||
/**
|
||||
* @var e_parse
|
||||
*/
|
||||
private $tp;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __construct($request, $response, $params = array())
|
||||
{
|
||||
parent::__construct($request, $response, $params);
|
||||
$this->tp = e107::getParser();
|
||||
}
|
||||
|
||||
|
||||
public function observe()
|
||||
{
|
||||
@@ -796,7 +810,7 @@ $columnInfo = array(
|
||||
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.duplicates">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm('. $this->getJsConfirm($row["download_id"]) .') \'/>
|
||||
</td>';
|
||||
$text .= '</tr>';
|
||||
}
|
||||
@@ -888,7 +902,7 @@ $columnInfo = array(
|
||||
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.missing">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm('. $this->getJsConfirm($row["download_id"]) .') \'/>
|
||||
</td>';
|
||||
$text .= '</tr>';
|
||||
}
|
||||
@@ -944,7 +958,7 @@ $columnInfo = array(
|
||||
}
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.inactive">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm('. $this->getJsConfirm($row["download_id"]) .') \'/>
|
||||
</td>';
|
||||
$text .= '</tr>';
|
||||
}
|
||||
@@ -996,7 +1010,7 @@ $columnInfo = array(
|
||||
}
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.nocategory">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm('. $this->getJsConfirm($row["download_id"]) .') \'/>
|
||||
</td>';
|
||||
$text .= '</tr>';
|
||||
}
|
||||
@@ -1047,7 +1061,7 @@ $columnInfo = array(
|
||||
$text .= '</td>';
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.filesize">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm('. $this->getJsConfirm($row["download_id"]) .') \'/>
|
||||
</td>';
|
||||
$text .= '</tr>';
|
||||
}
|
||||
@@ -2444,9 +2458,18 @@ $columnInfo = array(
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string|int $download_id
|
||||
* @return string
|
||||
*/
|
||||
private function getJsConfirm($download_id)
|
||||
{
|
||||
$tp = $this->tp;
|
||||
return $tp->toAttribute($tp->toJSON(DOWLAN_33 . ' [ID: ' . $download_id . ' ]'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class download_main_admin_form_ui extends e_admin_form_ui
|
||||
|
@@ -450,7 +450,7 @@ function init()
|
||||
echo "<script type=\"text/javascript\">
|
||||
function confirm_(thread_id)
|
||||
{
|
||||
return confirm(\"" . $tp->toJS(LAN_JSCONFIRM) . "\");
|
||||
return confirm(" . $tp->toJSON(LAN_JSCONFIRM) . ");
|
||||
}
|
||||
</script>";
|
||||
|
||||
|
@@ -396,9 +396,9 @@ else
|
||||
echo "<script type=\"text/javascript\">
|
||||
function confirm_(mode, forum_id, thread_id, thread) {
|
||||
if (mode == 'Thread') {
|
||||
return confirm(\"" . $tp->toJS(LAN_FORUM_2009) . "\");
|
||||
return confirm(" . $tp->toJSON(LAN_FORUM_2009) . ");
|
||||
} else {
|
||||
return confirm(\"" . $tp->toJS(LAN_FORUM_2010) . " [ " . $tp->toJS(LAN_FORUM_0074) . " \" + thread + \" ]\");
|
||||
return confirm(" . $tp->toJSON(LAN_FORUM_2010 . " [ " . LAN_FORUM_0074) . " + thread + \" ]\");
|
||||
}
|
||||
}
|
||||
</script>";
|
||||
|
@@ -813,7 +813,7 @@ class gsitemap
|
||||
<td class='center' style='white-space:nowrap'>
|
||||
<div>
|
||||
<button class='btn btn-default' type='submit' name='edit[{$row2['gsitemap_id']}]' value='edit' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' >".ADMIN_EDIT_ICON."</button>
|
||||
<button class='btn btn-default btn-secondary action delete' type='submit' name='delete[{$row2['gsitemap_id']}]' value='del' data-confirm='".$tp->toJS(LAN_CONFIRMDEL." [".$row2['gsitemap_name']."]")."' title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
|
||||
<button class='btn btn-default btn-secondary action delete' type='submit' name='delete[{$row2['gsitemap_id']}]' value='del' data-confirm='".$tp->toAttribute(LAN_CONFIRMDEL." [".$row2['gsitemap_name']."]")."' title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -529,7 +529,7 @@ e107::getLanguage()->bcDefs($bcDefs);
|
||||
$srch = array("<br />","'");
|
||||
$rep = array("\\n","\'");
|
||||
return "<script type='text/javascript'>
|
||||
alert('".$tp->toJS(LOGINMESSAGE)."');
|
||||
alert(".$tp->toJSON(LOGINMESSAGE).");
|
||||
</script>";
|
||||
}
|
||||
else
|
||||
|
@@ -157,7 +157,7 @@ class newsletter
|
||||
<td>".((substr_count($data['newsletter_subscribers'], chr(1))!= 0)?"<a href='".e_SELF."?vs.".$data['newsletter_id']."'>".substr_count($data['newsletter_subscribers'], chr(1))."</a>":substr_count($data['newsletter_subscribers'], chr(1)))."</td>
|
||||
<td>
|
||||
<a class='btn btn-default btn-secondary btn-large' href='".e_SELF."?edit.".$data['newsletter_id']."'>".ADMIN_EDIT_ICON."</a>
|
||||
<input class='btn btn-default btn-secondary btn-large' type='image' title='".LAN_DELETE."' name='delete[newsletter_".$data['newsletter_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [ID: ".$data['newsletter_id']." ]")."') \"/>
|
||||
<input class='btn btn-default btn-secondary btn-large' type='image' title='".LAN_DELETE."' name='delete[newsletter_".$data['newsletter_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(LAN_CONFIRMDEL." [ID: ".$data['newsletter_id']." ]")).") \"/>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@@ -206,8 +206,8 @@ class newsletter
|
||||
<td>".$data['newsletter_id']."</td>
|
||||
<td>".$data['newsletter_issue']."</td>
|
||||
<td>[ ".$data['newsletter_parent']." ] ".$data['newsletter_title']."</td>
|
||||
<td>".($data['newsletter_flag'] ? LAN_YES : "<input class='btn btn-default btn-secondary button' type='submit' name='nlmailnow_".$data['newsletter_id']."' value='".NLLAN_17."' onclick=\"return jsconfirm('".$tp->toJS(NLLAN_18)."') \" />")."</td>
|
||||
<td><a class='btn btn-large' href='".e_SELF."?edit.".$data['newsletter_id']."'>".ADMIN_EDIT_ICON."</a><input type='image' title='".LAN_DELETE."' name='delete[issue_".$data['newsletter_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(NLLAN_19." [ID: ".$data['newsletter_id']." ]")."') \"/>
|
||||
<td>".($data['newsletter_flag'] ? LAN_YES : "<input class='btn btn-default btn-secondary button' type='submit' name='nlmailnow_".$data['newsletter_id']."' value='".NLLAN_17."' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(NLLAN_18)).") \" />")."</td>
|
||||
<td><a class='btn btn-large' href='".e_SELF."?edit.".$data['newsletter_id']."'>".ADMIN_EDIT_ICON."</a><input type='image' title='".LAN_DELETE."' name='delete[issue_".$data['newsletter_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(NLLAN_19." [ID: ".$data['newsletter_id']." ]")).") \"/>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -84,13 +84,13 @@ foreach($newsletterArray as $nl)
|
||||
if(preg_match("#".chr(1).USERID."(".chr(1)."|$)#si", $nl['newsletter_subscribers']))
|
||||
{
|
||||
$text .= NLLAN_48."<br /><br />
|
||||
<input class='btn btn-sm btn-primary button' type='submit' name='nlUnsubscribe_".$nl['newsletter_id']."' value='".NLLAN_51."' onclick=\"return jsconfirm('".$tp->toJS(NLLAN_49)."') \" />
|
||||
<input class='btn btn-sm btn-primary button' type='submit' name='nlUnsubscribe_".$nl['newsletter_id']."' value='".NLLAN_51."' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(NLLAN_49)).") \" />
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= NLLAN_50." <b>".USEREMAIL."</b>)<br /><br />
|
||||
<input class='btn btn-sm btn-primary button' type='submit' name='nlSubscribe_".$nl['newsletter_id']."' value='".NLLAN_52."' onclick=\"return jsconfirm('".$tp->toJS(NLLAN_53)."') \" />
|
||||
<input class='btn btn-sm btn-primary button' type='submit' name='nlSubscribe_".$nl['newsletter_id']."' value='".NLLAN_52."' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(NLLAN_53))."') \" />
|
||||
";
|
||||
}
|
||||
$nl_count = $sql->count('newsletter', "(*)", "WHERE newsletter_parent='".$nl['newsletter_id']."' AND newsletter_flag='1'");
|
||||
|
@@ -211,7 +211,7 @@ function poll_list()
|
||||
$text .= "
|
||||
<td class='center' style='white-space:nowrap'>
|
||||
<button class='btn btn-default btn-secondary btn-large' type='submit' name='edit[{$poll_id}]' value='edit' alt='".LAN_EDIT."' title='".LAN_EDIT."' >".ADMIN_EDIT_ICON."</button>
|
||||
<button class='btn btn-default btn-secondary btn-large action delete' type='submit' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
|
||||
<button class='btn btn-default btn-secondary btn-large action delete' type='submit' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm(".$tp->toAttribute($tp->toJSON(LAN_CONFIRMDEL." [".$poll_id."]")).") \" title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
|
Reference in New Issue
Block a user