Esempio n. 1
0
                    //Sets logo filename in card data
                    $card->logo = $filename;
                }
                break;
                #TODO : more explicit error messages
            #TODO : more explicit error messages
            default:
                $errors[] = $Lang['Errors']['other_upload_error'];
        }
    }
    //3. Saves the card
    $card->save();
    $id = $card->id;
    //4. Keywords
    //TODO : more clever code
    Keywords::Truncate('C', $card->id);
    $keywords = explode(', ', $_POST['keywords']);
    foreach ($keywords as $keyword) {
        Keywords::Add('C', $card->id, $keyword);
    }
    //Yes, it's absolutely not optimized and very stupid to all delete and add again !
    $action = 'view';
} elseif ($_GET['action'] == 'clone') {
    //User's cloning a card, so erase base card info
    unset($id, $card->id);
}
if ($action == 'view') {
    //Come back to view mode after sucessfully posted form
    //Let's warn that our object $card is already there :)
    define('CARD_ALREADY_INITIALIZED', true);
    include 'view.php';