Completed
Push — master ( 797681...88d491 )
by Michael
02:02
created

include/functions.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * ****************************************************************************
4
 *  GBOOK - MODULE FOR XOOPS
5
 *  Copyright (c) 2007 - 2012
6
 *  Ingo H. de Boer (http://www.winshell.org)
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  (at your option) any later version.
12
 *
13
 *  You may not change or alter any portion of this comment or credits
14
 *  of supporting developers from this source code or any supporting
15
 *  source code which is considered copyrighted (c) material of the
16
 *  original comment or credit authors.
17
 *
18
 *  This program is distributed in the hope that it will be useful,
19
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 *  GNU General Public License for more details.
22
 *  ---------------------------------------------------------------------------
23
 *
24
 * @copyright       Ingo H. de Boer (http://www.winshell.org)
25
 * @license         GNU General Public License (GPL)
26
 * @package         GBook
27
 * @author          Ingo H. de Boer ([email protected])
28
 *
29
 * ****************************************************************************
30
 */
31
32
// defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined');
33
34
/**
35
 * @param $nameTmp
36
 * @param $emailTmp
37
 * @param $urlTmp
38
 * @param $messageTmp
39
 *
40
 * @return XoopsThemeForm
41
 */
42 View Code Duplication
function gbookSignForm($nameTmp, $emailTmp, $urlTmp, $messageTmp)
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
{
44
    $name      = new XoopsFormText(_GBOOK_NAME, 'Name', 43, 100, $nameTmp);
45
    $email     = new XoopsFormText(_GBOOK_EMAIL, 'Email', 43, 100, $emailTmp);
46
    $url       = new XoopsFormText(_GBOOK_URL, 'URL', 43, 100, $urlTmp);
47
    $message   = new XoopsFormTextArea(_GBOOK_MESSAGE, 'Message', $messageTmp);
48
    $submit    = new XoopsFormButton('', 'submit', _GBOOK_SUBMIT, 'submit');
49
    $gbookForm = new XoopsThemeForm(_GBOOK_SIGN, 'gbookform', 'sign.php');
50
51
    $gbookForm->addElement($name, true);
52
    $gbookForm->addElement($email);
53
    $gbookForm->addElement($url);
54
    $gbookForm->addElement($message, true);
55
    $gbookForm->addElement(new XoopsFormCaptcha(), true);
56
    $gbookForm->addElement($submit);
57
58
    return $gbookForm;
59
}
60
61
/**
62
 * @return string
63
 */
64 View Code Duplication
function gbookIP()
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
{
66
    $ip = 'UNKNOWN';
67
    if (getenv('HTTP_CLIENT_IP')) {
68
        $ip = getenv('HTTP_CLIENT_IP');
69
    } else {
70
        if (getenv('HTTP_X_FORWARDED_FOR')) {
71
            $ip = getenv('HTTP_X_FORWARDED_FOR');
72
        } else {
73
            if (getenv('REMOTE_ADDR')) {
74
                $ip = getenv('REMOTE_ADDR');
75
            }
76
        }
77
    }
78
79
    return $ip;
80
}
81