Commit 418c8b29 authored by Tim Schoondergang's avatar Tim Schoondergang
Browse files

Fixed param where functie + updated docs

parent 0692b9e6
{
"name": "timmit/db-mysql",
"description": "A simple DB layer in PHP for using MySQL",
"version": "v1.0.6",
"version": "v1.0.7",
"license": "MIT",
"homepage": "http://www.TiMMiT.nl/",
"authors": [
......
......@@ -144,28 +144,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1021899548"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1641832426"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1021899548" class="accordion-body collapse in">
<div id="namespace-1641832426" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-216666580"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1208149639"></a>
<a href="../namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-216666580" class="accordion-body collapse ">
<div id="namespace-1208149639" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1145984299"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-706346758"></a>
<a href="../namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-1145984299" class="accordion-body collapse ">
<div id="namespace-706346758" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -206,7 +206,7 @@
<h1><small>\TiMMiT\MySQL</small>DB</h1>
<p><em>MySQL DB connection.</em></p>
<p>Optionally use Jasny's Config class by configuring Config::i()->db;</p>
<section id="summary">
<h2>Summary</h2>
......@@ -293,15 +293,7 @@
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr>
<th>
example
</th>
<td>
<p>new DB($host, $user, $pwd, $dbname);<br/>
$result = DB::conn()->query("SELECT * FROM foo WHERE id = ?", $id);</p>
</td>
</tr>
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
......@@ -786,7 +778,7 @@
<article class="method">
<h3 class="public ">Clean4DB()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">Clean4DB(string <span class="argument">$var</span>) : string</pre>
<pre class="signature" style="margin-right: 54px;">Clean4DB(string <span class="argument">$value</span>, boolean <span class="argument">$key</span>) : string</pre>
<p><em>Clean variable for DB against SQL injection</em></p>
......@@ -794,8 +786,13 @@
<table class="table table-condensed table-hover">
<tr>
<td>string</td>
<td>$var </td>
<td>$value </td>
<td></td>
</tr>
<tr>
<td>boolean</td>
<td>$key </td>
<td><p>default false</p></td>
</tr>
</table>
......@@ -822,7 +819,7 @@
<article class="method">
<h3 class="public ">CleanFromDB()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">CleanFromDB(string <span class="argument">$var</span>) : string</pre>
<pre class="signature" style="margin-right: 54px;">CleanFromDB(string <span class="argument">$value</span>) : string</pre>
<p><em>Clean variable from DB against slashes against SQL injection</em></p>
......@@ -830,7 +827,7 @@
<table class="table table-condensed table-hover">
<tr>
<td>string</td>
<td>$var </td>
<td>$value </td>
<td></td>
</tr>
</table>
......@@ -1009,7 +1006,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -144,28 +144,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1925317628"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-784896404"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1925317628" class="accordion-body collapse in">
<div id="namespace-784896404" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1905400340"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-953907731"></a>
<a href="../namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-1905400340" class="accordion-body collapse ">
<div id="namespace-953907731" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1624138584"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1418132287"></a>
<a href="../namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-1624138584" class="accordion-body collapse ">
<div id="namespace-1418132287" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -292,7 +292,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -13,11 +13,6 @@ namespace TiMMiT\MySQL;
/**
* MySQL DB connection.
*
* Optionally use Jasny's Config class by configuring Config::i()->db;
*
* @example <br/>
* new DB($host, $user, $pwd, $dbname);<br/>
* $result = DB::conn()->query("SELECT * FROM foo WHERE id = ?", $id);
*
* @package DB-MySQL
*/
......@@ -175,26 +170,26 @@ namespace TiMMiT\MySQL;
/**
* Clean variable for DB against SQL injection
* @param string $var
* @param string $value
* @param boolean $key default false
* @return string
*/
public static function Clean4DB($var) {
//if(get_magic_quotes_gpc()){
// $var = stripslashes($var);
//}
return addcslashes(mysqli_real_escape_string(self::$mlink,$var), "%_");;
public static function Clean4DB($value,$key=false) {
$value = addcslashes(mysqli_real_escape_string(self::$mlink,$value), "%_");
if($key!=false){
$value = str_replace('\_',"_",$value);
}
return $value;
}
/**
* Clean variable from DB against slashes against SQL injection
* @param string $var
* @param string $value
* @return string
*/
public static function CleanFromDB($var) {
//if(get_magic_quotes_gpc()){
// $var = stripslashes($var);
//}
return stripcslashes($var);
public static function CleanFromDB($value) {
$value = stripcslashes($value);
return $value;
}
/**
......@@ -254,7 +249,7 @@ namespace TiMMiT\MySQL;
$value = DB::Clean4DB($value);
$value = str_replace('\_',"_",$value);
$value = str_replace('*',"%",$value);
$where = "`".str_replace('\_',"_",DB::Clean4DB($param))."`".DB::Clean4DB($operator)."'".DB::Clean4DB($value)."'";
$where = "`".str_replace('\_',"_",DB::Clean4DB($param))."` ".DB::Clean4DB($operator)." '".DB::Clean4DB($value)."'";
}
}
return $where;
......
......@@ -161,7 +161,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -96,28 +96,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-709217234"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-637029761"></a>
<a href="namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-709217234" class="accordion-body collapse in">
<div id="namespace-637029761" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-390242883"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-341917926"></a>
<a href="namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-390242883" class="accordion-body collapse ">
<div id="namespace-341917926" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-931592689"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-53832388"></a>
<a href="namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-931592689" class="accordion-body collapse ">
<div id="namespace-53832388" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -219,7 +219,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -96,28 +96,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-146967714"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1087666363"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-146967714" class="accordion-body collapse in">
<div id="namespace-1087666363" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1320433076"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-891196796"></a>
<a href="../namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-1320433076" class="accordion-body collapse ">
<div id="namespace-891196796" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1969224737"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-957942743"></a>
<a href="../namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-1969224737" class="accordion-body collapse ">
<div id="namespace-957942743" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -224,7 +224,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -96,28 +96,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-562710381"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-597923401"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-562710381" class="accordion-body collapse in">
<div id="namespace-597923401" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1766329401"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-625729703"></a>
<a href="../namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-1766329401" class="accordion-body collapse ">
<div id="namespace-625729703" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1020279844"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-13808194"></a>
<a href="../namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-1020279844" class="accordion-body collapse ">
<div id="namespace-13808194" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -221,7 +221,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -96,28 +96,28 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1348635740"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-328258017"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1348635740" class="accordion-body collapse in">
<div id="namespace-328258017" class="accordion-body collapse in">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-160375264"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1116195391"></a>
<a href="../namespaces/TiMMiT.html" style="margin-left: 30px; padding-left: 0">TiMMiT</a>
</div>
<div id="namespace-160375264" class="accordion-body collapse ">
<div id="namespace-1116195391" class="accordion-body collapse ">
<div class="accordion-inner">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1449043800"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-72794132"></a>
<a href="../namespaces/TiMMiT.MySQL.html" style="margin-left: 30px; padding-left: 0">MySQL</a>
</div>
<div id="namespace-1449043800" class="accordion-body collapse ">
<div id="namespace-72794132" class="accordion-body collapse ">
<div class="accordion-inner">
......@@ -219,7 +219,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -151,7 +151,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -150,7 +150,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -150,7 +150,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on May 21st, 2014 at 09:54.
on June 11th, 2014 at 15:27.
</section>
</section>
</section>
......
......@@ -249,7 +249,7 @@ namespace TiMMiT\MySQL;
$value = DB::Clean4DB($value);
$value = str_replace('\_',"_",$value);
$value = str_replace('*',"%",$value);
$where = "`".str_replace('\_',"_",DB::Clean4DB($param))."`".DB::Clean4DB($operator)."'".DB::Clean4DB($value)."'";
$where = "`".str_replace('\_',"_",DB::Clean4DB($param))."` ".DB::Clean4DB($operator)." '".DB::Clean4DB($value)."'";
}
}
return $where;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment