示例#1
0
 public function getLink()
 {
     if ($this->getType() == SourceItem::IMAGE_TYPE) {
         if ($this->_data['photo_service'] == 'twitpic') {
             return "http://twitpic.com/{$this->_data['photo_key']}";
         } elseif ($this->_data['photo_service'] == 'phodroid') {
             return "http://phodroid.com/{$this->_data['photo_key']}";
         }
     }
     $properties = new SourcesProperties(array(Stuffpress_Db_Properties::KEY => $this->_data['source_id']));
     $username = $properties->getProperty('username');
     $url = "http://twitter.com/{$username}/statuses/{$this->_data['twitter_id']}";
     return $url;
 }
示例#2
0
Zend_Registry::set("shard", $user->id);
// Fetch all sources and delete them
$sdb = new Sources();
$sources = $sdb->getSources();
// Delete all sources and associated items
if ($sources && count($sources) > 0) {
    foreach ($sources as $source) {
        // Instantiate a model and remove all the data
        $model = SourceModel::newInstance($source['service']);
        $model->setSource($source);
        $model->deleteItems();
        // Delete the duplicated from the Data table
        $data = new Data();
        $data->deleteItems($source['id']);
        // Delete the source settings
        $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
        $properties->deleteAllProperties();
        // Remove the source
        $sdb->deleteSource($source['id']);
        // We should also delete the associated comments
        $comments = new Comments();
        $comments->deleteComments($source['id']);
    }
}
// Delete all user files
$fdb = new Files();
$files = $fdb->getFiles();
if ($files && count($files) > 0) {
    foreach ($files as $file) {
        $fdb->deleteFile($file->key);
    }
示例#3
0
 public function deleteAction()
 {
     // Get the source from the request and initialize the model
     $id = $this->_getParam('id');
     // Get the sources database
     $sources = new Sources();
     // Check if the source exists
     if (!($source = $sources->getSource($id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Check if we own the source
     if ($source['user_id'] != $this->_application->user->id) {
         return $this->_helper->json->sendJson(true);
     }
     // Instantiate a model and remove all the data
     $model = SourceModel::newInstance($source['service']);
     $model->setSource($source);
     $model->deleteItems();
     // Delete the duplicated from the Data table
     $data = new Data();
     $data->deleteItems($source['id']);
     // Delete the source settings
     $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
     $properties->deleteAllProperties();
     // Delete the tags
     $tags = new Tags();
     $tags->deleteSource($source['id']);
     // Remove the source
     $sources->deleteSource($id);
     // We should also delete the associated comments
     $comments = new Comments();
     $comments->deleteComments($source['id']);
     // Forward to the list view with a success message
     return $this->_helper->json->sendJson(false);
 }
示例#4
0
 public function getLink()
 {
     if ($this->getType() == SourceItem::IMAGE_TYPE) {
         if ($this->_data['photo_service'] == 'twitpic') {
             return "http://twitpic.com/{$this->_data['photo_key']}";
         } elseif ($this->_data['photo_service'] == 'phodroid') {
             return "http://phodroid.com/{$this->_data['photo_key']}";
         }
     }
     $properties = new SourcesProperties(array(Stuffpress_Db_Properties::KEY => $this->_data['source_id']));
     $username = $properties->getProperty('username');
     if (($pos = strpos($username, '@')) == false) {
         $host = "http://identi.ca";
     } else {
         $host = substr($username, $pos + 1);
         $username = substr($username, 0, $pos);
     }
     $url = "http://{$host}/{$username}/statuses/{$this->_data['status_id']}";
     return $url;
 }