Exemple #1
0
 function deleteRecord($id)
 {
     $dir1 = substr($id, 0, 2);
     $dir2 = substr($id, 2, 2);
     $dir = $this->path . '/modules/photos/tpl/images/' . $dir1 . '/' . $dir2;
     $sql = "SELECT *\n                  FROM photos_images\n                  WHERE imageID='{$id}'";
     $image = $this->db->getRow($sql);
     if (PEAR::isError($image)) {
         return $image;
     }
     if (JxAdmin::deleteRecord($id)) {
         $sql = "DELETE\n                      FROM photos_albums_images\n                      WHERE imageID='{$id}'";
         $result = $this->db->query($sql);
         if (!DB::isError($result)) {
             $file = $dir . '/' . $id . '.' . $image['type'];
             $thumb = $dir . '/t_' . $id . '.' . $image['type'];
             if (unlink($file) && unlink($thumb)) {
                 return true;
             } else {
                 return PEAR::raiseError('Could not unlink ' . $file);
             }
         } else {
             return $result;
         }
     }
     return false;
 }
 function deleteRecord($id)
 {
     if (JxAdmin::deleteRecord($id)) {
         $sql = "SELECT *\n                FROM faq\n                WHERE categoryID='{$id}'";
         $result = $this->db->query($sql);
         if (!DB::isError($result) && $result->numRows()) {
             $sql = array();
             while ($row = $result->fetchRow()) {
                 $sql[] = "DELETE \n                      FROM content\n                      WHERE contentID='" . $row['contentID'] . "'";
             }
             $sql[] = "DELETE\n                    FROM faq\n                    WHERE categoryID='{$id}'";
             for ($i = 0; $i < count($sql); ++$i) {
                 $result = $this->db->query($sql[$i]);
             }
         }
         return true;
     }
     return false;
 }