var_dump($data); } // loop through messages foreach ($data->files as $item) { // check if has been successfully downloaded if ($item->status >= 4) { // check if file already exists $file = FileQuery::create()->filterByHash($item->hash)->findOne(); if (!$file) { // put file information into data base $file = new File(); $file->setHash($item->hash); $file->setSuffix($item->suffix); $file->setDescription($item->description); $file->setSize($item->size); $file->setTime($item->time); $file->setStatus($item->status); $file->save(); // advertise this file via twitter // TODO: send images < 3MB directly to twitter $txt = $file->getDescription() . " " . twitter_file_link($file); twitter_send2twitter($txt); if (get_debug()) { echo "advertised file on twitter: {$txt}\n"; } } } else { if ($item->status == -2) { // delete file $file = FileQuery::create()->filterByHash($item->hash)->delete(); }