removed unused global db-variables

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-17 12:31:15 +01:00
parent 97c6385c36
commit 0b3df4c7d7
2 changed files with 24 additions and 41 deletions

View File

@@ -25,29 +25,25 @@
* @param array $params Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3) * @param array $params Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string $targetname Name of the target eg Domain or eMail address etc. * @param string $targetname Name of the target eg Domain or eMail address etc.
* @param int $back_nr Number of steps to go back when "No" is pressed * @param int $back_nr Number of steps to go back when "No" is pressed
* *
* @author Florian Lippert <flo@syscp.org> * @author Florian Lippert <flo@syscp.org>
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* *
* @return string outputs parsed question_yesno template * @return string outputs parsed question_yesno template
*/ */
function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1) {
function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1) global $userinfo, $s, $header, $footer, $lng, $theme;
{
global $userinfo, $db, $s, $header, $footer, $lng, $theme;
$hiddenparams = ''; $hiddenparams = '';
if(is_array($params)) if (is_array($params)) {
{ foreach ($params as $field => $value) {
foreach($params as $field => $value)
{
$hiddenparams.= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n"; $hiddenparams.= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
} }
} }
if(isset($lng['question'][$text])) if (isset($lng['question'][$text])) {
{
$text = $lng['question'][$text]; $text = $lng['question'][$text];
} }
@@ -56,27 +52,23 @@ function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_n
exit; exit;
} }
function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true) function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true) {
{
global $userinfo, $db, $s, $header, $footer, $lng, $theme; global $userinfo, $s, $header, $footer, $lng, $theme;
$hiddenparams = ''; $hiddenparams = '';
if(is_array($params)) if (is_array($params)) {
{ foreach ($params as $field => $value) {
foreach($params as $field => $value)
{
$hiddenparams.= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n"; $hiddenparams.= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
} }
} }
if(isset($lng['question'][$text])) if (isset($lng['question'][$text])) {
{
$text = $lng['question'][$text]; $text = $lng['question'][$text];
} }
if(isset($lng['question'][$chk_text])) if (isset($lng['question'][$chk_text])) {
{
$chk_text = $lng['question'][$chk_text]; $chk_text = $lng['question'][$chk_text];
} }
@@ -90,4 +82,3 @@ function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $
eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";"); eval("echo \"" . getTemplate('misc/question_yesno_checkbox', '1') . "\";");
exit; exit;
} }

View File

@@ -25,15 +25,14 @@
* @author Florian Lippert <flo@syscp.org> * @author Florian Lippert <flo@syscp.org>
* @author Ron Brand <ron.brand@web.de> * @author Ron Brand <ron.brand@web.de>
*/ */
function standard_error($errors = '', $replacer = '') {
global $userinfo, $s, $header, $footer, $lng, $theme;
function standard_error($errors = '', $replacer = '')
{
global $db, $userinfo, $s, $header, $footer, $lng, $theme;
$_SESSION['requestData'] = $_POST; $_SESSION['requestData'] = $_POST;
$replacer = htmlentities($replacer); $replacer = htmlentities($replacer);
if(!is_array($errors)) if (!is_array($errors)) {
{
$errors = array( $errors = array(
$errors $errors
); );
@@ -45,25 +44,18 @@ function standard_error($errors = '', $replacer = '')
} }
$error = ''; $error = '';
foreach($errors as $single_error) foreach ($errors as $single_error) {
{ if (isset($lng['error'][$single_error])) {
if(isset($lng['error'][$single_error]))
{
$single_error = $lng['error'][$single_error]; $single_error = $lng['error'][$single_error];
$single_error = strtr($single_error, array('%s' => $replacer)); $single_error = strtr($single_error, array('%s' => $replacer));
} } else {
else
{
$error = 'Unknown Error (' . $single_error . '): ' . $replacer; $error = 'Unknown Error (' . $single_error . '): ' . $replacer;
break; break;
} }
if(empty($error)) if (empty($error)) {
{
$error = $single_error; $error = $single_error;
} } else {
else
{
$error.= ' ' . $single_error; $error.= ' ' . $single_error;
} }
} }