phpBMS

root/trunk/phpbms/modules/base/attachments_records.php

Revision 704, 5.1 KB (checked in by brieb, 2 years ago)
  • Fixed several SQL injection vulnerabilities
  • Fixed several XSS vulnerabilities due to PHP_SELF and REQUREST_URI
  • Fixed severa path disclosure errors
  • Property svn:keywords set to LastChangedBy LastChangedDate LastChangedRevision
Line 
1<?php
2/*
3 $Rev$ | $LastChangedBy$
4 $LastChangedDate$
5 +-------------------------------------------------------------------------+
6 | Copyright (c) 2004 - 2010, Kreotek LLC                                  |
7 | All rights reserved.                                                    |
8 +-------------------------------------------------------------------------+
9 |                                                                         |
10 | Redistribution and use in source and binary forms, with or without      |
11 | modification, are permitted provided that the following conditions are  |
12 | met:                                                                    |
13 |                                                                         |
14 | - Redistributions of source code must retain the above copyright        |
15 |   notice, this list of conditions and the following disclaimer.         |
16 |                                                                         |
17 | - Redistributions in binary form must reproduce the above copyright     |
18 |   notice, this list of conditions and the following disclaimer in the   |
19 |   documentation and/or other materials provided with the distribution.  |
20 |                                                                         |
21 | - Neither the name of Kreotek LLC nor the names of its contributore may |
22 |   be used to endorse or promote products derived from this software     |
23 |   without specific prior written permission.                            |
24 |                                                                         |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |
26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |
27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
28 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |
29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |
30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |
31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |
32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |
33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |
34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
36 |                                                                         |
37 +-------------------------------------------------------------------------+
38*/
39
40        $displayTable= new displaySearchTable($db);
41        $displayTable->base=$base;
42        $displayTable->initialize("tbld:edb8c896-7ce3-cafe-1d58-5aefbcd5f3d7");
43        $displayTable->querywhereclause=$whereclause;
44        $displayTable->tableoptions["printex"]=0;
45        $displayTable->tableoptions["othercommands"]=false;
46        $displayTable->tableoptions["select"]=0;
47
48        if(isset($_POST["deleteCommand"]))
49                if($_POST["deleteCommand"]) $_POST["command"]=$_POST["deleteCommand"];
50
51        if(isset($_POST["command"])){
52                switch($_POST["command"]){
53                        case $displayTable->thetabledef["deletebutton"]:
54                                //=====================================================================================================
55
56                        include_once("modules/base/include/attachments.php");
57
58                        $theids=explode(",",$_POST["theids"]);
59
60                        $searchFunctions = new attachmentsSearchFunctions($db,$displayTable->thetabledef["uuid"],$theids);
61
62                        $tempmessage = $searchFunctions->delete_record();
63                        if($tempmessage) $statusmessage=$tempmessage;
64
65                        include_once("modules/base/include/notes.php");
66
67                        break;
68                }//end switch
69        }
70
71        //on the fly sorting... this needs to be done after command processing or the querystatement will not work.
72        if(!isset($_POST["newsort"])) $_POST["newsort"]="";
73        if(!isset($_POST["desc"])) $_POST["desc"]="";
74
75        if($_POST["newsort"]!="") {
76                //$displayTable->setSort($_POST["newsort"]);
77                foreach ($displayTable->thecolumns as $therow){
78                        if ($_POST["newsort"]==$therow["name"]) $therow["sortorder"]? $displayTable->querysortorder=$therow["sortorder"] : $displayTable->querysortorder=$therow["column"];
79                }
80                $_POST["startnum"]=1;
81        } elseif($_POST["desc"]!="")  $displayTable->querysortorder.=" DESC";
82
83        //record offset?
84        if(isset($_POST["offset"])) if($_POST["offset"]!="") $displayTable->recordoffset=$_POST["offset"];
85
86        $displayTable->issueQuery();
87
88        $phpbms->cssIncludes[] = "pages/search.css";
89        $phpbms->jsIncludes[] = "common/javascript/queryfunctions.js";
90        $phpbms->topJS[] = 'xtraParamaters="backurl="+encodeURIComponent("'.$backurl.'")+String.fromCharCode(38)+"tabledefid="+encodeURIComponent("'.$tabledefuuid.'")+String.fromCharCode(38)+"refid='.$refid.'";';
91
92        include("header.php");
93        $phpbms->showTabs($tabgroup,$selectedtabid,$_GET["id"]);?><div class="bodyline">
94        <h1><?php echo $pageTitle ?></h1>
95        <div>
96                <form name="search" id="search" action="<?php echo htmlentities($_SERVER["REQUEST_URI"])?>" method="post" onsubmit="setSelIDs(this);return true;">
97                <input name="theids" type="hidden" value="" />
98                <?php
99                        $displayTable->displayQueryButtons();
100
101                        $displayTable->displayResultTable();
102                ?>
103                </form>
104        </div>
105</div>
106<?php include("footer.php");?>
Note: See TracBrowser for help on using the browser.
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.