コード例 #1
0
ファイル: photos.php プロジェクト: abbenbouchta/immobilier
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
$mesg = '';
$object = new Local($db);
if ($id > 0 || !empty($ref)) {
    $result = $object->fetch($id, $ref);
    $dir = $conf->immobilier->dir_output . '/photo/' . dol_sanitizeFileName($object->id);
}
/*
 * Actions
 */
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    if ($object->id) {
        $result = $object->add_photo($dir, $_FILES['userfile']);
    }
}
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer)) {
    $object->delete_photo($dir . "/" . $_GET["file"]);
}
if ($action == 'addthumb' && $_GET["file"]) {
    $object->add_thumb($dir . "/" . $_GET["file"]);
}
/*
 *	View
 */
$form = new Form($db);
if ($object->id) {
    llxHeader("", "", $langs->trans("CardProduct" . $object->type));
    /*