Permalink
Browse files

Classes data, db y load corregidas, helpers forms, security y string …

…corregidos
  • Loading branch information...
1 parent 519b36c commit 8e835d8c922a705799ae616f448a19e5540288e3 @MilkZoft committed Nov 23, 2011
View
2 www/applications/default/controllers/controller.default.php
@@ -20,7 +20,7 @@ public function index() {
print "Welcome to ZanPHP";
}
- public function prueba($param1, $param2) {
+ public function prueba($param1 = NULL, $param2 = NULL) {
print "Funciona el nuevo sistema de rutas: $param1, $param2";
}
View
3 zan/classes/class.data.php
@@ -52,6 +52,7 @@ public function __construct() {
"dPath",
"dDirname",
"dDirbase",
+ "iDirbase",
"ID"
);
@@ -126,7 +127,7 @@ public function proccess($data = NULL, $validations = FALSE) {
foreach($POST as $field => $value) {
if(!in_array($field, $this->ignore)) {
if(!isset($data[$this->rename($field)])) {
- $data[$this->rename($field)] = decode($value);
+ $data[$this->rename($field)] = decode(filter($value, "escape"));
}
}
}
View
2 zan/classes/class.db.php
@@ -761,7 +761,7 @@ public function insert($table = NULL, $data = NULL) {
} else {
return FALSE;
}
-
+
$this->Rs = $this->Database->query($query);
if($this->Rs) {
View
6 zan/classes/class.load.php
@@ -466,6 +466,8 @@ public function library($name, $library = NULL, $application = NULL) {
die("$name library doesn't exists");
}
} else {
+ $lib = str_replace("class.", "", $name);
+
if(file_exists(_corePath . _sh . _libraries . _sh . $lib . _sh . strtolower($name) . _PHP)) {
include_once _corePath . _sh . _libraries . _sh . $lib . _sh . strtolower($name) . _PHP;
} else {
@@ -620,7 +622,9 @@ public function template($name, $vars = NULL) {
$this->views[$i]["vars"] = FALSE;
}
- $this->render();
+ if($name !== "include" and _autoRender) {
+ $this->render();
+ }
}
/**
View
18 zan/helpers/helper.forms.php
@@ -411,9 +411,25 @@ function formTextarea($attributes = FALSE) {
}
function formSave($action = NULL) {
+ if(isLang()) {
+ if($action === "save") {
+ $href = _webPath . segment(1) . _sh . _cpanel . _sh . _add . _sh;
+ } else {
+ $href = _webPath . segment(1) . _sh . _cpanel . _sh . _edit . _sh;
+ }
+ } else {
+ if($action === "save") {
+ $href = _webPath . segment(0) . _sh . _cpanel . _sh . _add . _sh;
+ } else {
+ $href = _webPath . segment(0) . _sh . _cpanel . _sh . _edit . _sh;
+ }
+ }
+
+ $onclick = 'onclick="document.getElementById(\'form-add\').target=\'\'; document.getElementById(\'form-add\').action=\''. $href .'\'"';
+
$HTML = '
<p class="save-cancel">
- <input id="'. $action .'" name="'. $action .'" value="'. __(ucfirst($action)) .'" type="submit" class="submit save" />
+ <input id="'. $action .'" name="'. $action .'" value="'. __(ucfirst($action)) .'" '. $onclick .' type="submit" class="submit save">
<input id="cancel" name="cancel" value="'. __("Cancel") .'" type="submit" class="submit cancel" />
</p>';
View
2 zan/helpers/helper.security.php
@@ -125,7 +125,7 @@ function parseHTTP($string) {
*/
function ping($domain) {
$domain = str_replace("http://", "", $domain);
-
+
if(!@file_get_contents("http://" . $domain)) {
return FALSE;
} else {
View
7 zan/helpers/helper.string.php
@@ -372,12 +372,14 @@ function POST($position = FALSE, $coding = "decode", $filter = "escape") {
} else {
$POST = encrypt($_POST[$position]);
}
- } elseif($coding === "decode") {
+ } elseif($coding === "decode") {
if($filter === TRUE) {
$POST = filter(decode($_POST[$position]), TRUE);
} elseif($filter === "escape") {
$POST = filter(decode($_POST[$position]), "escape");
- } else {
+ } elseif($filter === NULL) {
+ $POST = decode($_POST[$position]);
+ } else {
$data = decode($_POST[$position]);
$data = str_replace("'", "\'", $data);
@@ -392,6 +394,7 @@ function POST($position = FALSE, $coding = "decode", $filter = "escape") {
$POST = $_POST[$position];
}
}
+
} else {
return FALSE;
}

0 comments on commit 8e835d8

Please sign in to comment.