Пример #1
0
        case 'image/jpeg':
            $extension = 'jpg';
            break;
        case 'image/gif':
            $extension = 'gif';
            break;
        case 'image/png':
            $extension = 'png';
            break;
        default:
            $extension = '';
    }
    if ($extension != '') {
        $image_name = pathinfo($_FILES[$name]['name'])['filename'] . '.' . $extension;
        $image_file = 'img-uploads/' . $image_name;
        try {
            move_uploaded_file($tmp_name, $image_file);
        } catch (Exception $e) {
            print_r($e);
        }
    }
    return $image_name;
}
if (isset($_FILES['media1'])) {
    $file_name = getUploadedFile('media1');
    echo "uploadReady('" . $file_name . "');";
}
if (isset($_FILES['media2'])) {
    $file_name = getUploadedFile('media2');
    echo "uploadReadyB('" . $file_name . "');";
}
Пример #2
0
    }
    // If we haven't encountered any problems so far then save the changes
    if ($exec_changes == true) {
        //$date_list = split('[- :]',$release_date,5);
        //$release_date = mktime($date_list[3],$date_list[4],0,$date_list[1],$date_list[2],$date_list[0]);
        $release_date = strtotime($release_date);
        if (!$frsr->update($status_id, $release_name, $notes, $changes, $preformatted, $release_date)) {
            exit_error('Error', $frsr->getErrorMessage());
        } else {
            $feedback .= _('Data Saved');
        }
    }
}
// Add file(s) to the release
if (getStringFromRequest('step2')) {
    $userfile = getUploadedFile('userfile');
    $userfile_name = $userfile['name'];
    $type_id = getIntFromRequest('type_id');
    $release_date = getStringFromRequest('release_date');
    $release_date = strtotime($release_date);
    $processor_id = getStringFromRequest('processor_id');
    // Build a Unix time value from the supplied Y-m-d value
    $group_unix_name = group_getunixname($group_id);
    $ftp_filename = getStringFromRequest('ftp_filename');
    if ($userfile && is_uploaded_file($userfile['tmp_name']) || $sys_use_ftpuploads && $ftp_filename) {
        if ($sys_use_ftpuploads && $ftp_filename && util_is_valid_filename($ftp_filename) && is_file($upload_dir . '/' . $ftp_filename)) {
            //file was uploaded already via ftp
            //use setuid prog to chown it
            //$cmd = escapeshellcmd("$sys_ftp_upload_chowner $ftp_filename");
            //exec($cmd,$output);
            $userfile_name = $ftp_filename;
Пример #3
0
$upload_dir = $sys_ftp_upload_dir . "/" . $g->getUnixName();
//
//
//	Submit the changes to the database
//
//
if (getStringFromRequest('submit')) {
    if ($editdoc) {
        $doc_group = getIntFromRequest('doc_group');
        $title = getStringFromRequest('title');
        $description = getStringFromRequest('description');
        $language_id = getIntFromRequest('language_id');
        $data = getStringFromRequest('data');
        $file_url = getStringFromRequest('file_url');
        //$ftp_filename = getStringFromRequest('ftp_filename');
        $uploaded_data = getUploadedFile('uploaded_data');
        $stateid = getIntFromRequest('stateid');
        $filetype = getStringFromRequest('filetype');
        $editor = getStringFromRequest('editor');
        $d = new Document($g, $docid);
        if ($d->isError()) {
            exit_error(_('Error'), $d->getErrorMessage());
        }
        $sanitizer = new TextSanitizer();
        $data = $sanitizer->SanitizeHtml($data);
        if ($editor && $d->getFileData() != $data && !$uploaded_data['name']) {
            $filename = $d->getFileName();
            if (!$filetype) {
                $filetype = $d->getFileType();
            }
        } elseif ($uploaded_data['name']) {
<?php

define('MAXROWS', 5000);
/* max records to import from the csv file per run */
define('BATCHSIZE', 100);
/* number of records to insert per query */
ignore_user_abort(true);
set_time_limit(0);
@ini_set('auto_detect_line_endings', '1');
$d = dirname(__FILE__);
require "{$d}/incCommon.php";
include "{$d}/incHeader.php";
$arrTables = getTableList();
if ($_POST['csvPreview'] != '') {
    $fn = strpos($_POST['csvPreview'], 'Apply') === false ? getUploadedFile('csvFile') : $_SESSION['csvUploadFile'];
    $headCellStyle = 'border: solid 1px white; border-bottom: solid 1px #C0C0C0; border-right: solid 1px #C0C0C0; background-color: #ECECFB; font-weight: bold; font-size: 12px; padding: 0 2px;';
    $dataCellStyle = 'border: solid 1px white; border-bottom: solid 1px #C0C0C0; border-right: solid 1px #C0C0C0; font-size: 10px; padding: 0 2px;';
    if (!is_file($fn)) {
        ?>
			<div class="status" style="color: red;">
				Error: File '<?php 
        echo $fn;
        ?>
' not found.
				</div>
			<?php 
        include "{$d}/incFooter.php";
        exit;
    }
    ?>
		<!--<div align=left>
Пример #5
0
 }
 $res = db_query($sql1);
 $res2 = db_query($sql2);
 if (!$res || !$res2) {
     exit_error("Attachment error", "DB Error");
 }
 if (!(db_result($res2, 0, 'posted_by') == user_getid() || $f->userIsAdmin())) {
     goodbye(_('You cannot edit this attachment'));
 } else {
     if ($doedit == "1") {
         //actually edit the attach and save the info
         forum_header(array('title' => _('Attachments')));
         $am = new AttachManager();
         $fm = new ForumMessage($f, $msg_id, false, false);
         $am->SetForumMsg($fm);
         $attach = getUploadedFile("attachment1");
         if ($attachid) {
             //update existing one
             $attachok = $am->attach($attach, $group_id, $attachid, $msg_id);
             if ($attachok != false) {
                 $fm->fetchData($msg_id);
                 $fm->sendAttachNotice($attachok);
             }
         } else {
             //add new one
             $attachok = $am->attach($attach, $group_id, $attachid, $msg_id);
             if ($attachok != false) {
                 $fm->fetchData($msg_id);
                 $fm->sendAttachNotice($attachok);
             }
         }
Пример #6
0
        $ath->clearError();
    } else {
        $feedback .= _('Tracker Updated');
    }
    //
    //	Delete a tracker
    //
} elseif (getStringFromRequest('delete')) {
    $sure = getStringFromRequest('sure');
    $really_sure = getStringFromRequest('really_sure');
    if (!$ath->delete($sure, $really_sure)) {
        $feedback .= _('Error updating') . ' : ' . $ath->getErrorMessage();
    } else {
        header("Location: /tracker/admin/?group_id={$group_id}&tracker_deleted=1");
        exit;
    }
    //
    //	Upload template
    //
} elseif (getStringFromRequest('uploadtemplate')) {
    $input_file = getUploadedFile('input_file');
    if (!util_check_fileupload($input_file)) {
        echo 'Invalid filename';
        exit;
    }
    $size = $input_file['size'];
    $input_data = addslashes(fread(fopen($input_file['tmp_name'], 'r'), $size));
    db_query("UPDATE artifact_group_list SET custom_renderer='{$input_data}' WHERE group_artifact_id='" . $ath->getID() . "'");
    echo db_error();
    $feedback .= 'Renderer Uploaded';
}
Пример #7
0
<?php

require_once $gfcommon . 'pm/import_utils.php';
$input_file = getUploadedFile('userfile');
if (is_uploaded_file($input_file['tmp_name'])) {
    $size = $input_file['size'];
    $handle = fopen($input_file['tmp_name'], 'r');
    $tasks = array();
    while (($cols = fgetcsv($handle, 4096, ",")) !== FALSE) {
        $resources = array();
        for ($i = 12; $i < 17; $i++) {
            if (trim($cols[$i]) != '') {
                $resources[] = array('user_name' => $cols[$i]);
            }
        }
        $dependentOn = array();
        for ($i = 17; $i < 30; $i = $i + 3) {
            if (trim($cols[$i]) != '') {
                $dependentOn[] = array('task_id' => $cols[$i], 'msproj_id' => $cols[$i + 1], 'task_name' => '', 'link_type' => $cols[$i + 2]);
            }
        }
        $tasks[] = array('id' => $cols[0], 'msproj_id' => $cols[1], 'parent_id' => $cols[2], 'parent_msproj_id' => $cols[3], 'name' => $cols[4], 'duration' => $cols[5], 'work' => $cols[6], 'start_date' => $cols[7], 'end_date' => $cols[8], 'percent_complete' => $cols[9], 'priority' => $cols[10], 'resources' => $resources, 'dependenton' => $dependentOn, 'notes' => $cols[11]);
    }
}
$res =& pm_import_tasks($group_project_id, &$tasks);
if ($res['success']) {
    $feedback .= 'Import Was Successful';
} else {
    $feedback .= $res['errormessage'];
}