Esempio n. 1
0
 /**
  * Delete more rows
  *
  * Deletes the rows matching the $filter conditions. The syntax of $filter
  * is data engine dependent: no assumptions are made by the TIP_Data class.
  * This also means the $filter parameter must be prepared for the engine:
  * use the prepare... primitives provided by the data engine.
  *
  * Notice empty filter are rejected by the engine to avoid dropping the
  * whole content of a table.
  *
  * @param  string $filter The row filter
  * @return bool           true on success or false on errors
  */
 public function deleteRows($filter)
 {
     // Empty filter are by default not accepted
     if (empty($filter)) {
         return false;
     }
     return $this->engine->delete($this, $filter);
 }
Esempio n. 2
0
 protected function runUntrustedAction($action)
 {
     switch ($action) {
         case 'backup':
             include_once 'HTTP/Download.php';
             include_once 'Archive/Tar.php';
             if (!$this->data_engine->dump(TIP::buildDataPath('dump'))) {
                 TIP::notifyError('backup');
                 return false;
             }
             $tar_file = TIP::buildCachePath($this->id . '-' . TIP::formatDate('date_sql') . '.tar.gz');
             $tar_object = new Archive_Tar($tar_file, 'gz');
             $result = $tar_object->createModify(TIP::buildDataPath(), '', TIP::buildPath());
             unset($tar_object);
             if ($result !== true) {
                 return false;
             }
             HTTP_Download::staticSend(array('file' => $tar_file, 'contenttype' => 'application/x-gzip', 'contentdisposition' => HTTP_DOWNLOAD_ATTACHMENT));
             exit;
     }
     return null;
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * Initializes a TIP_Mysql instance.
  *
  * $options inherits the TIP_Type properties, and add the following:
  * - $options['server']:   server address
  * - $options['database']: database name (required)
  * - $options['user']:     user name (required)
  * - $options['password']: user password (required)
  *
  * @param array $options Properties values
  */
 protected function __construct($options)
 {
     parent::__construct($options);
     $this->_connection = mysql_connect($this->server, $this->user, $this->password);
     if (!$this->_connection || !mysql_select_db($this->database, $this->_connection)) {
         TIP::error(mysql_error($this->_connection));
     } else {
         $this->query('SET CHARACTER SET utf8');
     }
 }
Esempio n. 4
0
 /**
  * Constructor
  *
  * Initializes a TIP_Bucket instance.
  *
  * @param array $options Properties values
  */
 protected function __construct($options)
 {
     parent::__construct($options);
 }