Example #1
0
 public static function mail_file($f, $d, $file_id)
 {
     $t = time() + 3600 * 24 * 7;
     $url = Utils_AttachmentCommon::create_remote($file_id, 'mail', $t);
     $x = ModuleManager::get_instance('/Base_Box|0');
     $x->push_main('CRM_Roundcube', 'new_mail', array('', __('File attachment, expires on: %s', array(Base_RegionalSettingsCommon::time2reg($t))), "<br /><br />" . $url));
 }
Example #2
0
 * @subpackage attachment
 */
if (!isset($_REQUEST['cid']) || !isset($_REQUEST['file'])) {
    die('Invalid usage');
}
$cid = $_REQUEST['cid'];
$id = $_REQUEST['file'];
if (isset($_REQUEST['description'])) {
    $description = $_REQUEST['description'];
} else {
    $description = '';
}
define('CID', $cid);
define('READ_ONLY_SESSION', true);
require_once '../../../include.php';
ModuleManager::load_modules();
if (!Acl::is_user()) {
    die('Permission denied');
}
$file = DB::GetRow('SELECT uaf.attach_id, uaf.original FROM utils_attachment_file uaf WHERE uaf.id=%d', array($id));
$rec = Utils_RecordBrowserCommon::get_record('utils_attachment', $file['attach_id']);
if (!$rec) {
    die('Invalid attachment.');
}
$access_fields = Utils_RecordBrowserCommon::get_access('utils_attachment', 'view', $rec);
if (!isset($access_fields['note']) || !$access_fields['note']) {
    die('Access forbidden');
}
$t = time() + 3600 * 24 * 7;
print Utils_AttachmentCommon::create_remote($id, $description, $t);