Esempio n. 1
0
 /**
  * @author Mauricio Giraldo
  * @desc Executes a query stores in $sql variable
  * @version 1.0 03/05/2010
  * @param None
  * @return Boolean
  */
 public function query($sql = "")
 {
     if (!$sql) {
         $sql = $this->sql;
     }
     // Validate malicious code is not present:
     //if (!strpos(strtolower($sql), "alter") && !strpos(strtolower($sql), "drop") && !strpos(strtolower($sql), "create")) {
     logFactory::log($this, $sql);
     $this->RES = mysql_query($sql) or logFactory::error($this, mysql_error());
     //$this->RES = mysql_query($sql) or print(mysql_error().":".$sql);
     $cache = new cache();
     if (${$_POST}["do"] == "insert_exec" && $_POST["do"] != "insert_exec" && $_POST["do"] != "edit_exec") {
         $cache->clear();
     }
     return true;
     //}
     //else
     //return false;
 }
 function compress()
 {
     logFactory::log($this, "Using " . $this->mode);
     global $upload_folder, $zip_folder;
     if ($this->mode == "terminal") {
         $res = array();
         $command = "zip " . $zip_folder . $this->zip_name . " " . implode(" ", $this->files);
         exec($command, $res);
         logFactory::log($this, $command);
         logFactory::log($this, implode(",", $res));
     } else {
         $zip = new ZipArchive();
         $filename = $zip_folder . $this->zip_name;
         if ($zip->open($filename, ZIPARCHIVE::CREATE) == TRUE) {
             foreach ($this->files as $file) {
                 $zip->addFile($upload_folder . $file);
             }
             $zip->close();
         }
     }
 }
 function sendMail()
 {
     logFactory::log("SendMail", "recipient = \"" . $this->to . "\" subject= \"" . $this->subject . "\" body = \"" . $this->body . "\" script = \"" . $_SERVER['SCRIPT_FILENAME'] . "\" user_id = \"" . $_SESSION["user_id"] . "\"");
     return mail($this->to, $this->subject, $this->body, "From:" . $this->from . "\r\nReply-to: " . $this->from . "\r\nContent-type: text/html; charset=us-ascii");
 }