Ejemplo n.º 1
0
 public function deleteAction()
 {
     // Get, check and setup the parameters
     $story_id = $this->getRequest()->getParam("id");
     //Verify if the requested story exist
     $stories = new Stories();
     if (!($story = $stories->getStory($story_id))) {
         return $this->_helper->json->sendJson(false);
     }
     // Check if we are the owner
     if ($this->_application->user->id != $story->user_id) {
         return $this->_helper->json->sendJson(false);
     }
     // Ok, we can hide the item
     $stories->deleteStory($story_id);
     return $this->_helper->json->sendJson(true);
 }
Ejemplo n.º 2
0
    }
}
// Delete all user files
$fdb = new Files();
$files = $fdb->getFiles();
if ($files && count($files) > 0) {
    foreach ($files as $file) {
        $fdb->deleteFile($file->key);
    }
}
// Delete all stories
$stdb = new Stories();
$stories = $stdb->getStories();
if ($stories && count($stories) > 0) {
    foreach ($stories as $story) {
        $stdb->deleteStory($story['id']);
    }
}
// Delete all widgets
$wdb = new Widgets();
$widgets = $wdb->getWidgets();
if ($widgets && count($widgets) > 0) {
    foreach ($widgets as $widget) {
        $wdb->deleteWidget($widget['id']);
    }
}
// Delete all properties
$up = new Properties(array(Properties::KEY => $user->id));
$up->deleteAllProperties();
$wp = new WidgetsProperties(array(Properties::KEY => $user->id));
$wp->deleteAllProperties();