Issues (212)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

class/category.php (1 issue)

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
// This program is free software; you can redistribute it and/or modify     //
5
// it under the terms of the GNU General Public License as published by     //
6
// the Free Software Foundation; either version 2 of the License, or        //
7
// (at your option) any later version.                                      //
8
//                                                                          //
9
// You may not change or alter any portion of this comment or credits       //
10
// of supporting developers from this source code or any supporting         //
11
// source code which is considered copyrighted (c) material of the          //
12
// original comment or credit authors.                                      //
13
//                                                                          //
14
// This program is distributed in the hope that it will be useful,          //
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of           //
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
17
// GNU General Public License for more details.                             //
18
//                                                                          //
19
// You should have received a copy of the GNU General Public License        //
20
// along with this program; if not, write to the Free Software              //
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
22
// ------------------------------------------------------------------------ //
23
// Author: phppp (D.J., [email protected])                                  //
24
// URL: https://xoops.org                         //
25
// Project: Article Project                                                 //
26
// ------------------------------------------------------------------------ //
27
/**
28
 * @package   module::article
29
 * @copyright copyright &copy; 2005 XoopsForge.com
30
 */
31
32
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
33
require_once __DIR__ . '/../include/vars.php';
34
//mod_loadFunctions('', $GLOBALS['moddirname']);
35
36
/**
37
 * Xcategory
38
 *
39
 * @author    D.J. (phppp)
40
 * @copyright copyright &copy; 2005 XoopsForge.com
41
 * @package   module::article
42
 *
43
 * {@link XoopsObject}
44
 **/
45 View Code Duplication
if (!class_exists('Bcategory')):
0 ignored issues
show
This code seems to be duplicated across 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...
46
47
    /**
48
     * Class Bcategory
49
     */
50
    class Bcategory extends XoopsObject
51
    {
52
        /**
53
         * Constructor
54
         */
55
        public function __construct()
56
        {
57
            //            $this->ArtObject();
58
            $this->table = planet_DB_prefix('category');
59
            $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false);
60
            $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true);
61
            $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false);
62
        }
63
    }
64
65
endif;
66
/**
67
 * Category object handler class.
68
 * @package   module::article
69
 *
70
 * @author    D.J. (phppp)
71
 * @copyright copyright &copy; 2005 XOOPS Project
72
 *
73
 * {@link XoopsPersistableObjectHandler}
74
 *
75
 * @param CLASS_PREFIX variable prefix for the class name
76
 */
77
78
PlanetUtility::planetParseClass('
79
class [CLASS_PREFIX]CategoryHandler extends XoopsPersistableObjectHandler
80
{
81
    /**
82
     * Constructor
83
     *
84
     * @param object $db reference to the {@link XoopsDatabase} object
85
     **/
86
    public function __construct(\XoopsDatabase $db) {
87
        parent::__construct($db, planet_DB_prefix("category", true), "Bcategory", "cat_id", "cat_title");
88
    }
89
90
    public function delete(\XoopsObject $category, $force = false)
91
    {
92
        xoops_notification_deletebyitem($GLOBALS["xoopsModule"]->getVar("mid"), "category", $category->getVar("cat_id"));
93
94
        /* remove category-blog links */
95
        $sql = "DELETE FROM ".planet_DB_prefix("blogcat")." WHERE cat_id = ".$category->getVar("cat_id");
96
        if (!$result = $this->db->queryF($sql)) {
97
        }
98
99
        parent::delete($category, true);
100
    }
101
102
    /**
103
     * get a list of categories including a blog
104
     *
105
     * @param  object $criteria {@link CriteriaElement} to match
106
     * @param  bool   $asObject flag indicating as object, otherwise as array
107
     * @return array  of categories {@link Bcategory}
108
     */
109
       public function &getByBlog($criteria = null, $asObject = false)
110
    {
111
        $sql = "SELECT bc.cat_id".
112
                " FROM " . planet_DB_prefix("blogcat")." AS bc";
113
        $limit = null;
114
        $start = null;
115
        if (isset($criteria) && is_subclass_of($criteria, "criteriaelement")) {
116
            $sql .= " ".$criteria->renderWhere();
117
            if ($criteria->getSort() != "") {
118
                $sql .= " ORDER BY ".$criteria->getSort()." ".$criteria->getOrder();
119
                $orderSet = true;
120
            }
121
            $limit = $criteria->getLimit();
122
            $start = $criteria->getStart();
123
        }
124
        if(empty($orderSet)) $sql .= " ORDER BY cat_id DESC";
125
        $result = $this->db->query($sql, $limit, $start);
126
        $ret = array();
127
       while (false !== ($myrow = $this->db->fetchArray($result))) {
128
            $ret[$myrow["cat_id"]] = 1;
129
        }
130
        if (!empty($asObject)) {
131
            $crit = new \Criteria("cat_id", "(".implode(",",array_keys($ret)).")", "IN");
132
            $ret =& $this->getObjects($crit);
133
        }
134
135
        return $ret;
136
    }
137
138
    /**
139
     * get a list of blogs to a category
140
     *
141
     * @param  int   $category category ID
142
     * @param  array $blogs    array of blog IDs
143
     * @return bool
144
     */
145
       public function addBlogs($category, $blogs)
146
    {
147
        $_values = array();
148
        foreach ($blogs as $blog) {
149
            $sql = "SELECT COUNT(*)".
150
                " FROM ".planet_DB_prefix("blogcat").
151
                " WHERE cat_id=".(int)($category)." AND blog_id=".(int)($blog);
152
            if (!$result = $this->db->query($sql)) {
153
                continue;
154
            }
155
            list($count) = $this->db->fetchRow($result);
156
            if($count>0) continue;
157
            $_values[] = "(".(int)($blog).", ".(int)($category).")";
158
        }
159
        $values = implode(",",$_values);
160
        $sql = "INSERT INTO ".planet_DB_prefix("blogcat")." (blog_id, cat_id) VALUES ". $values;
161
        if (!$result = $this->db->queryF($sql)) {
162
            PlanetUtility::planetDisplayMessage("Insert blog-cat error:" . $sql);
163
164
            return false;
165
        }
166
167
        return count($_values);
168
    }
169
    /**
170
     * remove a list of blogs from a category
171
     *
172
     * @param  int   $category category ID
173
     * @param  array $blogs    array of blog IDs
174
     * @return bool
175
     */
176
       public function removeBlogs($category, $blogs)
177
    {
178
        if (count($blogs)>0) {
179
            $sql = "DELETE FROM ".planet_DB_prefix("blogcat")." WHERE cat_id=".(int)($category)." AND blog_id IN (".implode(",", $blogs).")";
180
            if (!$result = $this->db->queryF($sql)) {
181
                PlanetUtility::planetDisplayMessage("remove blog-cat error:" . $sql);
182
            }
183
          }
184
185
        return count($blogs);
186
    }
187
}
188
');
189