Exemple #1
0
<?php

@session_start();
require_once '../../../cscms/lib/Cs_Config.php';
require_once '../../../cscms/lib/Cs_Kpan.php';
require_once 'kuaipan.class.php';
$oauth_token = isset($_REQUEST['oauth_token']) ? $_REQUEST['oauth_token'] : '';
$oauth_verifier = isset($_REQUEST['oauth_verifier']) ? $_REQUEST['oauth_verifier'] : '';
$filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : '';
$kp = new Kuaipan(CS_Kp_Ck, CS_Kp_Cs);
if (!empty($filename)) {
    $access_token_arr['oauth_token'] = CS_Kp_Acc;
    $access_token_arr['oauth_token_secret'] = CS_Kp_Acc_Key;
    $params = array('root' => 'app_folder', 'path' => $filename);
    $filename = dirname(__FILE__) . '/' . $file_name;
    $ret = $kp->api('fileops/download_file', '', $params, 'GET', $filename, $access_token_arr);
    if (false === $ret) {
        $ret = $kp->getError();
    } else {
        header("Location: " . $ret . "");
        exit;
    }
} elseif (empty($oauth_token)) {
    $authorization_uri = $kp->getAuthorizationUri('http://' . Web_Url . Web_Path . 'packs/uploads/kdisk/acc.php');
    if (false === $authorization_uri) {
        echo 'request token error' . '<br />';
        echo nl2br(var_export($kp->getError()));
        exit;
    } else {
        header('Location:' . $authorization_uri);
        exit;
Exemple #2
0
 function kdiskdel($file_path)
 {
     require_once CSCMSPATH . 'uploads/kdisk/kuaipan.class.php';
     if (substr($file_path, 0, 1) == '/') {
         $file_path = substr($file_path, 1);
     }
     $kp = new Kuaipan(CS_Kp_Ck, CS_Kp_Cs);
     $params = array('root' => 'app_folder', 'path' => $file_path);
     $access_token_arr['oauth_token'] = CS_Kp_Acc;
     $access_token_arr['oauth_token_secret'] = CS_Kp_Acc_Key;
     $ret = $kp->api('fileops/delete', '', $params, 'GET', '', $access_token_arr);
     if (false === $ret) {
         return false;
     } else {
         return true;
     }
 }