Пример #1
0
        if ($real_path = common_doc_path($extra_path, true)) {
            // Common document
            if (!$common_doc_visible) {
                forbidden($downloadDir);
            }
            $dload_filename = $real_path;
            $delete = false;
        } else {
            // External document - redirect to URL
            redirect($extra_path);
        }
    } else {
        $dload_filename = $basedir . $downloadDir;
        $delete = false;
    }
    send_file_to_client($dload_filename, $real_filename, null, true, $delete);
    exit;
}
if ($can_upload) {
    $error = false;
    $uploaded = false;
    if (isset($_POST['uploadPath'])) {
        $uploadPath = str_replace('\'', '', $_POST['uploadPath']);
    } else {
        $uploadPath = '';
    }
    // Check if upload path exists
    if (!empty($uploadPath)) {
        $result = Database::get()->querySingle("SELECT count(*) as total FROM document\n                        WHERE {$group_sql} AND\n                        path = ?s", $uploadPath);
        if (!$result || !$result->total) {
            $error = $langImpossible;
 }
 if ($ExportCsv) {
     include_once SELF . "/lib/export_csv.inc.php";
     $CsvNames['Name'] = "--";
     $CsvNames['CntClick|CntClickPerc'] = $Lang['TotalHits'];
     $CsvNames['UniClick|UniClickPerc'] = $Lang['UniVisitors'];
     $CsvNames['CntAction|CntActionPerc'] = $Lang['TotalActions'];
     $CsvNames['UniAction|UniActionPerc'] = $Lang['ByVisitors'];
     $CsvNames['CntSale|CntSalePerc'] = $Lang['TotalSales'];
     $CsvNames['UniSale|UniSalePerc'] = $Lang['ByVisitors'];
     $CsvNames['ROI'] = $Lang['ROI'];
     $CsvNames['CampCost'] = $Lang['CampCost'];
     $CsvNames['TotalIncome'] = $Lang['CampIncome'];
     $CsvNames['ActionConv|ActionConvOne'] = $Lang['ActionsConv'];
     $CsvNames['SaleConv|SaleConvOne'] = $Lang['SalesConv'];
     send_file_to_client("export.csv", ExportCsv($Report->CampStat, $ExportSep, $CsvNames, $ExportExpanded));
 }
 if ($nsUser->Columns->GRAPHS) {
     $StatArrName = "CampStat";
     $DateFormat = $GroupBy;
     if ($GroupBy == "Date" || $GroupBy == "Month" || $GroupBy == "Time" || $GroupBy == "Year" || $GroupBy == "WeekDay") {
         include_once SELF . "/lib/date_graph.inc.php";
     }
     if ($GroupBy != "General" && $GroupBy != "Date" && $GroupBy != "Month" && $GroupBy != "Time" && $GroupBy != "Year" && $GroupBy != "WeekDay") {
         include_once SELF . "/lib/pie_graph.inc.php";
     }
 }
 include $nsTemplate->Inc("inc/" . ($Print ? "print_" : "") . "header");
 if (!$Print) {
     include $nsTemplate->Inc("inc/submenu");
 }
Пример #3
0
    header("Location: ${urlServer}");
    exit();
}

if ($uid) {
    require_once 'include/action.php';
    $action = new action();
    $action->record(MODULE_ID_VIDEO);
}

// ----------------------
// download video
// ----------------------
$res2 = Database::get()->querySingle("SELECT * FROM video
                  WHERE course_id = ?d AND id = ?d", $course_id, $_GET['id']);

if (!$res2) {
    header("Location: ${urlServer}");
    exit();
}

$valid = ($uid || course_status($course_id) == COURSE_OPEN) ? true : token_validate($row2['path'], $_GET['token'], 30);
if (!$valid) {
    header("Location: ${urlServer}");
    exit();
}

$vObj = MediaResourceFactory::initFromVideo($res2);
$real_file = $webDir . "/video/" . q($_GET['course']) . q($vObj->getPath());
send_file_to_client($real_file, my_basename(q($vObj->getUrl())), $disposition, true);
Пример #4
0
/**
 * 
 * @global type $basedir 
 * @param type $file_path
 * @param type $initial_path
 */
function send_file_by_url_file_path($file_path, $initial_path = '') {
    global $basedir;

    $path_components = explode('/', str_replace('//', chr(1), $file_path));
    $file_info = public_path_to_disk_path($path_components, $initial_path);

    if (!send_file_to_client($basedir . $file_info->path, $file_info->filename, null, false)) {
        not_found($file_path);
    }
    exit;
}
function GenLink($UrlTO = false, $Keyword = false)
{
    global $_GP, $CampId, $Logs, $Lang, $SplitId, $nsProduct, $UseSSL, $LinkArr;
    global $AllowCSV, $csv, $Db, $UseRedirect, $SiteId;
    global $VarCamp, $VarKw, $VarKeyword, $KeyArr;
    $ExportSep = $Lang['SeparatorValue'];
    if (!$CampId && !$SplitId) {
        $Logs->Err($Lang['NeedToChoose']);
        return;
    }
    if ($CampId && !$SplitId) {
        if (!$UrlTO) {
            $Logs->Err($Lang['UrlNeeded']);
            return;
        }
    }
    //if ($UrlTO&&!CheckURLTO($UrlTO)) return false;
    //if (!$SplitId) $UseSSL=false;
    if ($UseSSL) {
        $HL = $nsProduct->HL;
        $nsProduct->HL = $nsProduct->SSL_LINK;
    }
    $Keyword = trim($Keyword);
    $CSVArr = array();
    if ($CampId && $csv) {
        $CampName = $Db->ReturnValue("SELECT NAME FROM " . PFX . "_tracker_camp_piece WHERE ID = {$CampId}");
    }
    if ($SplitId && $csv) {
        $SplitName = $Db->ReturnValue("SELECT CP.NAME FROM " . PFX . "_tracker_camp_piece CP WHERE CP.ID = {$SplitId}");
    }
    if ($CampId && !$SplitId) {
        if (!$UseRedirect) {
            $Link = "";
            $Link .= $UrlTO;
            if (strpos($Link, "?")) {
                $Link .= "&";
            } else {
                $Link .= "?";
            }
            $Link .= "{$VarCamp}={$CampId}";
        } else {
            $Link = getURL("campaign", "cid={$CampId}&st={$SiteId}", "track");
            $Link .= "&rurl=" . urlencode($UrlTO);
        }
        $Keyword = trim(ToLower($Keyword));
        $KeyArr = array();
        if ($Keyword) {
            $KeyArr = explode("\n", $Keyword);
            $KeyArr = array_unique($KeyArr);
        }
        $Inx = 0;
        if (count($KeyArr) > 0) {
            for ($i = 0; $i < count($KeyArr); $i++) {
                if (!isset($KeyArr[$i]) || !$KeyArr[$i]) {
                    continue;
                }
                $KeyArr[$i] = trim($KeyArr[$i]);
                $LinkVar = "";
                $KeyId = CheckKeyword($KeyArr[$i]);
                if ($KeyId) {
                    $LinkVar = $Link . "&{$VarKeyword}={$KeyId}";
                }
                $LinkArr[$i] = $LinkVar;
                if ($csv) {
                    $CSVArr[$Inx]['Link'] = $LinkVar;
                    $CSVArr[$Inx]['Keyword'] = $KeyArr[$i];
                    $CSVArr[$Inx]['Camp'] = $CampName;
                }
                $Inx++;
            }
        } else {
            $Logs->Msg($Link);
        }
    }
    if ($CampId && $SplitId) {
        $GLOBALS['GLink'] = false;
        $Id = GetSplitId($SplitId);
        if (!MOD_R) {
            $Link = getURL("split", "s={$Id}&{$VarCamp}={$CampId}", "track");
        } else {
            $Link = str_replace(".html", "", getURL("split", "", "track"));
            $Link .= "/s{$Id}/{$VarCamp}{$CampId}/";
        }
        $Keyword = trim(ToLower($Keyword));
        $KeyArr = array();
        if ($Keyword) {
            $KeyArr = explode("\n", $Keyword);
            $KeyArr = array_unique($KeyArr);
        }
        $Inx = 0;
        if (count($KeyArr) > 0) {
            for ($i = 0; $i < count($KeyArr); $i++) {
                if (!isset($KeyArr[$i]) || !$KeyArr[$i]) {
                    continue;
                }
                $KeyArr[$i] = trim($KeyArr[$i]);
                $Keyword = $KeyArr[$i];
                $LinkVar = "";
                $KeyId = CheckKeyword($Keyword);
                if ($KeyId && !MOD_R) {
                    $LinkVar = $Link . "&{$VarKeyword}={$KeyId}";
                }
                if ($KeyId && MOD_R) {
                    $LinkVar = $Link . "{$VarKeyword}{$KeyId}/";
                }
                $LinkArr[$i] = $LinkVar;
                if ($csv) {
                    $CSVArr[$Inx]['Link'] = $LinkVar;
                    $CSVArr[$Inx]['Keyword'] = $KeyArr[$i];
                    $CSVArr[$Inx]['Split'] = $SplitName;
                    $CSVArr[$Inx]['Camp'] = $CampName;
                }
                $Inx++;
            }
        } else {
            $Logs->Msg($Link);
        }
    }
    if ($SplitId && !$CampId) {
        $GLOBALS['GLink'] = false;
        $GLOBALS['GKey'] = false;
        $Id = GetSplitId($SplitId);
        if (!MOD_R) {
            $SLink = getURL("split", "s={$Id}", "track");
        } else {
            $SLink = str_replace(".html", "", getURL("split", "", "track"));
            $SLink .= "/s{$Id}/";
        }
        $Logs->Msg($SLink);
    }
    if (ValidArr($KeyArr) && count($KeyArr) > 1) {
        $AllowCSV = true;
    }
    if ($UseSSL) {
        $nsProduct->HL = $HL;
    }
    if ($csv) {
        $NamesArr['Keyword'] = $Lang['ColumnKey'];
        $NamesArr['Link'] = $Lang['ColumnLink'];
        if ($SplitId) {
            $NamesArr['Split'] = $Lang['ColumnSplit'];
        }
        if ($CampId) {
            $NamesArr['Camp'] = $Lang['ColumnCamp'];
        }
        send_file_to_client("links.csv", ExportCsv($CSVArr, $ExportSep, $NamesArr));
    }
}
Пример #6
0
function download_file($post)
{
    $fullPath = $post->guid;
    $site_url = get_site_url();
    $wpDir = ABSPATH;
    $fullPath = str_replace($site_url . '/', $wpDir, $fullPath);
    error_log("FullPath: " . $fullPath);
    send_file_to_client($fullPath);
}
Пример #7
0
function send_file($id, $file_type)
{
    global $course_code, $uid, $is_editor;
    if (isset($file_type)) {
        $info = Database::get()->querySingle("SELECT * FROM assignment WHERE id = ?d", $id);
        if (count($info) == 0) {
            return false;
        }
        if (!($is_editor || $GLOBALS['is_member'])) {
            return false;
        }
        send_file_to_client("{$GLOBALS['workPath']}/admin_files/{$info->file_path}", $info->file_name, null, true);
    } else {
        $info = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $id);
        if (count($info) == 0) {
            return false;
        }
        if ($info->group_id) {
            initialize_group_info($info->group_id);
        }
        if (!($is_editor or $info->uid == $uid or $GLOBALS['is_member'])) {
            return false;
        }
        send_file_to_client("{$GLOBALS['workPath']}/{$info->file_path}", $info->file_name, null, true);
    }
    exit;
}
Пример #8
0
        exit;
    } elseif (!$common_doc_visible) {
        forbidden(preg_replace('/^.*file\\.php/', '', $uri));
    }
} else {
    // Normal file
    $disk_path = $basedir . $file_info->path;
}
if (file_exists($disk_path)) {
    if (!$is_in_playmode) {
        $valid = $uid || course_status($course_id) == COURSE_OPEN ? true : token_validate($file_info->path, $_GET['token'], 30);
        if (!$valid) {
            not_found(preg_replace('/^.*file\\.php/', '', $uri));
            exit;
        }
        send_file_to_client($disk_path, $file_info->filename);
    } else {
        require_once 'include/lib/fileDisplayLib.inc.php';
        require_once 'include/lib/multimediahelper.class.php';
        $mediaPath = file_url($file_info->path, $file_info->filename);
        $mediaURL = $urlServer . 'modules/document/index.php?course=' . $course_code . '&amp;download=' . $file_info->path;
        if (defined('GROUP_DOCUMENTS')) {
            $mediaURL = $urlServer . 'modules/group/index.php?course=' . $course_code . '&amp;group_id=' . $group_id . '&amp;download=' . $file_info->path;
        }
        $token = token_generate($file_info->path, true);
        $mediaAccess = $mediaPath . '?token=' . $token;
        echo MultimediaHelper::mediaHtmlObjectRaw($mediaAccess, $mediaURL, $mediaPath);
        exit;
    }
} else {
    not_found(preg_replace('/^.*file\\.php/', '', $uri));
Пример #9
0
function send_file($id, $file_type) {
    global $course_code, $uid, $is_editor, $courses;
    if (isset($file_type)) {
        $info = Database::get()->querySingle("SELECT * FROM assignment WHERE id = ?d", $id);
        // don't show file if: assignment nonexistent, not editor, not active assignment, module not visible
        if (count($info) == 0 or
            !($is_editor or
              ($info->active and visible_module(MODULE_ID_ASSIGN)))) {
            return false;
        }
        send_file_to_client("$GLOBALS[workPath]/admin_files/$info->file_path", $info->file_name, null, true);
    } else {
        $info = Database::get()->querySingle("SELECT * FROM assignment_submit WHERE id = ?d", $id);
        if (count($info)==0) {
            return false;
        }
        if ($info->group_id) {
            initialize_group_info($info->group_id);
        }
        if (!($is_editor or $info->uid == $uid or $GLOBALS['is_member'])) {
            return false;
        }
        send_file_to_client("$GLOBALS[workPath]/$info->file_path", $info->file_name, null, true);
    }
    exit;
}
Пример #10
0
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
/**
 * @file dropbox_download.php
 * @brief Download files from dropbox
 */
$require_login = TRUE;
$require_current_course = TRUE;

include '../../include/baseTheme.php';
require_once 'class.msg.php';
require_once 'include/lib/forcedownload.php';

$dropbox_dir = $webDir . "/courses/" . $course_code . "/dropbox";

if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    header("Location: $urlServer");
}

$work = new Msg($id, $uid, 'any');
if (!$work->error) {
    $path = $dropbox_dir . "/" . $work->filename; //path to file as stored on server
    $file = $work->real_filename;
    
    send_file_to_client($path, $file, null, true);
}
exit;
Пример #11
0
$course_id = null;
$res1 = Database::get()->querySingle("SELECT course.id FROM course WHERE course.code = ?s", q($_GET['course']));
if ($res1) {
    $course_id = intval($res1->id);
}
if ($course_id == null) {
    header("Location: {$urlServer}");
    exit;
}
if ($uid) {
    require_once 'include/action.php';
    $action = new action();
    $action->record(MODULE_ID_VIDEO);
}
// ----------------------
// download video
// ----------------------
$res2 = Database::get()->querySingle("SELECT * \n                   FROM video \n                  WHERE course_id = {$course_id}\n                    AND id = ?d", $_GET['id']);
if (!$res2) {
    header("Location: {$urlServer}");
    exit;
}
$valid = $uid || course_status($course_id) == COURSE_OPEN ? true : token_validate($row2['path'], $_GET['token'], 30);
if (!$valid) {
    header("Location: {$urlServer}");
    exit;
}
$vObj = MediaResourceFactory::initFromVideo($res2);
$real_file = $webDir . "/video/" . q($_GET['course']) . q($vObj->getPath());
send_file_to_client($real_file, my_basename(q($vObj->getUrl())), 'inline', true);
Пример #12
0
/**
 * 
 * @global type $basedir
 * @global type $uid
 * @param type $file_path
 * @param type $initial_path
 */
function send_file_by_url_file_path($file_path, $initial_path = '')
{
    global $basedir, $uid;
    $path_components = explode('/', str_replace('//', chr(1), $file_path));
    $file_info = public_path_to_disk_path($path_components, $initial_path);
    $valid = $uid ? true : token_validate($file_info->path, $_GET['token'], 30);
    if (!$valid) {
        header("Location: {$urlServer}");
        exit;
    }
    if (!send_file_to_client($basedir . $file_info->path, $file_info->filename, null, false)) {
        not_found($file_path);
    }
    exit;
}