Пример #1
0
            $rc = $DB_LINK->Execute($sql);
            // If the recipe is owned by someone else then do not allow editing
            if ($rc->fields['recipe_user'] != "" && $rc->fields['recipe_user'] != $SMObj->getUserID()) {
                die($LangUI->_('You do not have sufficient privileges to delete this recipe!'));
            }
        }
        /* Go ahead and do the delete */
        // clean up the old picture if we are suppose to
        if ($g_rb_database_type == "postgres") {
            $sql = "SELECT recipe_picture FROM {$db_table_recipes} WHERE recipe_id=" . $DB_LINK->addq($recipe_id, get_magic_quotes_gpc());
            $rc = $DB_LINK->Execute($sql);
            if (trim($rc->fields['recipe_picture']) != "") {
                $rc = $DB_LINK->BlobDelete($rc->fields['recipe_picture']);
                DBUtils::checkResult($rc, $LangUI->_('Picture successfully deleted'), NULL, $sql);
            }
        }
        // In Postgres everything will be cleaned up with one delete
        $RecipeObj = new Recipe($recipe_id);
        $RecipeObj->delete();
    }
    $iterator++;
    $item_id = "recipe_id_" . $iterator;
    $item_delete = "recipe_selected_" . $iterator;
}
?>
<I><?php 
echo $LangUI->_('Recipe Deleted');
?>
</I>
<P>
Пример #2
0
 function delete($id = false)
 {
     #esli ID ne peredaetsa to perehod na spisok
     if (!$id) {
         $this->show();
         return;
     }
     $recipe = new Recipe();
     $recipe->get_full_info($id);
     if ($recipe->id) {
         #
         foreach ($recipe->recipe_step as $recipe_step) {
             $this->upload_image_lib->delete_img('recipe', $recipe_step->image);
         }
         $recipe->recipe_step->delete_all();
         #
         foreach ($recipe->recipe_image as $recipe_image) {
             $this->upload_image_lib->delete_img('recipe', $recipe->id . '_' . $recipe_image->id);
         }
         $recipe->recipe_image->delete_all();
         #
         $recipe->delete();
     }
     $this->show();
 }