Esempio n. 1
0
function addPicture($FID, $moduleName)
{
    $f = file_load($FID);
    $f->status = FILE_STATUS_PERMANENT;
    file_save($f);
    addUsage($f, $moduleName);
    // tells Drupal we're using the file
}
Esempio n. 2
0
function uploadMedia_submit($form, &$form_state)
{
    global $user;
    $params = drupal_get_query_parameters();
    $OID = $params['OID'];
    foreach ($form_state['values']['file'] as $picture) {
        $media = array();
        $media['FID'] = $picture->fid;
        $media['UID'] = $user->uid;
        $media['OID'] = $OID;
        dbAddMedia($media);
        addUsage($picture, 'Media');
    }
    drupal_set_message(t('Upload successful.'));
    drupal_goto('viewMedia', array('query' => array('OID' => $OID)));
}
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

 2006 Namont Nicolas
 

 include/admin_usage.php V0.1
*/
// gestion des fonctions des postes
// traitement des post
$act = $_GET["act"];
$idusage = $_GET["idusage"];
switch ($act) {
    case 1:
        // creation
        $usage = $_POST["newusage"];
        if (FALSE == addUsage($usage)) {
            echo getError(0);
        }
        break;
    case 2:
        // modification
        $usage = $_POST["usage"];
        if (FALSE == modUsage($idusage, $usage)) {
            echo getError(0);
        }
        break;
    case 3:
        // suppression
        if (FALSE == supUsage($idusage)) {
            echo getError(0);
        }