~thomas-juberg/bebot/main

« back to all changes in this revision

Viewing changes to Core/Aoc/Items.php

  • Committer: Thomas Juberg
  • Date: 2013-10-28 03:11:16 UTC
  • Revision ID: git-v1:55563839a2071dbee7d3bda0a2f643a0c9c32852
- Fix IntelliJ project files
- Update .gitignore
- Auto reformat code to PSR-1/PSR-2 code formatting (A lot of work will need to be done to implement PSR-0, PSR-1 and PSR-2 fully, but this should take care of the general formatting)

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    /*
71
71
    Creates a text blob.  Alternate uses ' instead of ".
72
72
    */
73
 
    function make_item($item, $alternate = FALSE)
 
73
    function make_item($item, $alternate = false)
74
74
    {
75
75
        if (empty($item)) {
76
76
            return '';
77
77
        }
78
78
        if ($alternate) {
79
79
            return '<a style="text-decoration:none" href="itemref://' . $item['lowid'] . '/' . $item['highid'] . '/' . $item['ql'] . '/' . $item['lowcrc'] . '/' . $item['highcrc']
80
 
                . '"><font color=#' . $item['colour'] . '>[' . $item['name'] . ']</font></a>';
81
 
        }
82
 
        else {
 
80
            . '"><font color=#' . $item['colour'] . '>[' . $item['name'] . ']</font></a>';
 
81
        } else {
83
82
            return "<a style='text-decoration:none' href='itemref://" . $item['lowid'] . "/" . $item['highid'] . "/" . $item['ql'] . "/" . $item['lowcrc'] . "/" . $item['highcrc']
84
 
                . "'><font color=#" . $item['colour'] . ">[" . $item['name'] . "]</font></a>";
 
83
            . "'><font color=#" . $item['colour'] . ">[" . $item['name'] . "]</font></a>";
85
84
        }
86
85
    }
87
86
 
90
89
    function is_item($item)
91
90
    {
92
91
        if (1 > preg_match('/' . $this->itemPattern . '/i', $item)) {
93
 
            return FALSE;
 
92
            return false;
94
93
        }
95
 
        return TRUE;
 
94
        return true;
96
95
    }
97
96
 
98
97
 
103
102
        }
104
103
        $checksum = md5(
105
104
            'aocitems' + $item['lowid'] + $item['highid'] + $item['ql'] + $item['lowcrc'] + $item['highcrc'] + $item['colour'] + $item['itemname'] + $this->bot->dimension
106
 
                + $this->bot->guild + $name
 
105
            + $this->bot->guild + $name
107
106
        );
108
107
        $url = $this->server . "botsubmit/v3/";
109
108
        $url .= '?lowid=' . urlencode($item['lowid']);
128
127
        $url .= '&id=' . $words;
129
128
        $result = $this->bot->core("tools")->get_site($url, 1);
130
129
        //A comment explaining the logic of this check would be appreciated! Why are we looking for mysql_real_escape_string here?
131
 
        if (strstr($result, 'mysql_real_escape_string') !== FALSE) {
 
130
        if (strstr($result, 'mysql_real_escape_string') !== false) {
132
131
            return ("Error in query to database");
133
132
        }
134
133
        return $result;