${
"GLOBALS"
}
["vshhrfyit"]="ch";
${
"GLOBALS"
}
["oypfcvryhne"]="timestamp";
${
"GLOBALS"
}
["fcdbmh"]="ctimestamp";
${
"GLOBALS"
}
["jhwflihqjwgv"]="res";
${
"GLOBALS"
}
["sjkbeo"]="base";
${
"GLOBALS"
}
["yqtwle"]="token";
${
"GLOBALS"
}
["kkdutxrwe"]="content";
${
"GLOBALS"
}
["xjyiled"]="type";
${
"GLOBALS"
}
["cyoyryx"]="fp";
${
"GLOBALS"
}
["wtjrtgfqfos"]="filename";
${
"GLOBALS"
}
["zyimyuv"]="opts";
${
"GLOBALS"
}
["nnkttzjunijk"]="parent_id";
${
"GLOBALS"
}
["hlxocgbgjqk"]="name";
${
"GLOBALS"
}
["auzvrqtxhd"]="return";
${
"GLOBALS"
}
["sxndwbx"]="array";
${
"GLOBALS"
}
["psmdfsmolua"]="item";
${
"GLOBALS"
}
["dumhselvj"]="folder";
${
"GLOBALS"
}
["nogpid"]="data";
${
"GLOBALS"
}
["chwttkcfh"]="json";
${
"GLOBALS"
}
["xpjhmkhyjyn"]="code";
${
"GLOBALS"
}
["oyosnilv"]="params";
${
"GLOBALS"
}
["nbgosmlt"]="url";
${
"GLOBALS"
}
["sonksib"]="redirect_uri";
${
"GLOBALS"
}
["zyuoebtuier"]="client_secret";
${
"GLOBALS"
}
["ijvwgsgn"]="client_id";
if(!class_exists("SLMBoxAPI")){
class SLMBoxAPI{
public$client_id='';
public$client_secret='';
public$redirect_uri='';
public$access_token='';
public$refresh_token='';
public$authorize_url='https://www.box.com/api/oauth2/authorize';
public$token_url='https://www.box.com/api/oauth2/token';
public$api_url='https://api.box.com/2.0';
public$upload_url='https://upload.box.com/api/2.0';
public function __construct($client_id='',$client_secret='',$redirect_uri=''){
if(empty(${
${
"GLOBALS"
}
["ijvwgsgn"]
}
)||empty(${
${
"GLOBALS"
}
["zyuoebtuier"]
}
)){
throw("Invalid CLIENT_ID or CLIENT_SECRET or REDIRECT_URL. Please provide CLIENT_ID, CLIENT_SECRET and REDIRECT_URL when creating an instance of the class.");
}
else{
$this->client_id=${
${
"GLOBALS"
}
["ijvwgsgn"]
};
$this->client_secret=${
${
"GLOBALS"
}
["zyuoebtuier"]
};
$this->redirect_uri=${
${
"GLOBALS"
}
["sonksib"]
};
}
}
public function get_code(){
if(array_key_exists("refresh_token",$_REQUEST)){
$this->refresh_token=$_REQUEST["refresh_token"];
}
else{
echo${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->authorize_url."?".http_build_query(array("response_type"=>"code","client_id"=>$this->client_id,"redirect_uri"=>$this->redirect_uri));
header("location: ".${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
}
public function get_token($code='',$json=false){
$tysuxn="url";
${
$tysuxn
}
=$this->token_url;
if(!empty($this->refresh_token)){
${
${
"GLOBALS"
}
["oyosnilv"]
}
=array("grant_type"=>"refresh_token","refresh_token"=>$this->refresh_token,"client_id"=>$this->client_id,"client_secret"=>$this->client_secret);
}
else{
${
"GLOBALS"
}
["rfiiivqb"]="params";
${
${
"GLOBALS"
}
["rfiiivqb"]
}
=array("grant_type"=>"authorization_code","code"=>${
${
"GLOBALS"
}
["xpjhmkhyjyn"]
}
,"client_id"=>$this->client_id,"client_secret"=>$this->client_secret);
}
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
);
}
else{
$xluzdnnewamy="params";
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
$xluzdnnewamy
}
),true);
}
}
public function get_user(){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/users/me");
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
public function get_folder_details($folder,$json=false){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/folders/$folder");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
$hissrnzliwf="url";
return json_decode($this->get(${
$hissrnzliwf
}
),true);
}
}
public function get_folder_items($folder,$json=false){
$rcnlhbsslgs="url";
${
$rcnlhbsslgs
}
=$this->build_url("/folders/$folder/items");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
$mkfkggvvw="url";
return$this->get(${
$mkfkggvvw
}
);
}
else{
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
}
public function get_folder_collaborators($folder,$json=false){
${
"GLOBALS"
}
["ogrwxoml"]="url";
${
${
"GLOBALS"
}
["ogrwxoml"]
}
=$this->build_url("/folders/$folder/collaborations");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
}
public function get_folders($folder){
${
${
"GLOBALS"
}
["nogpid"]
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["dumhselvj"]
}
);
foreach(${
${
"GLOBALS"
}
["nogpid"]
}
["entries"]as${
${
"GLOBALS"
}
["psmdfsmolua"]
}
){
$zbgfsnk="item";
$dhpzhojkck="return";
${
${
"GLOBALS"
}
["sxndwbx"]
}
="";
if(${
$zbgfsnk
}
["type"]=="folder"){
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["psmdfsmolua"]
};
}
${
$dhpzhojkck
}
[]=${
${
"GLOBALS"
}
["sxndwbx"]
};
}
return array_filter(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
);
}
public function get_files($folder){
$yiojxijmprz="data";
${
$yiojxijmprz
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["dumhselvj"]
}
);
foreach(${
${
"GLOBALS"
}
["nogpid"]
}
["entries"]as${
${
"GLOBALS"
}
["psmdfsmolua"]
}
){
$huithvgjmcwh="array";
$ayqlypd="array";
${
"GLOBALS"
}
["cxjpagsjju"]="return";
${
$huithvgjmcwh
}
="";
if(${
${
"GLOBALS"
}
["psmdfsmolua"]
}
["type"]=="file"){
${
"GLOBALS"
}
["fmxqckhsxvns"]="item";
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["fmxqckhsxvns"]
};
}
${
${
"GLOBALS"
}
["cxjpagsjju"]
}
[]=${
$ayqlypd
};
}
${
"GLOBALS"
}
["bfnybbiogkl"]="return";
return array_filter(${
${
"GLOBALS"
}
["bfnybbiogkl"]
}
);
}
public function get_links($folder){
${
"GLOBALS"
}
["cncpyejop"]="data";
${
"GLOBALS"
}
["edjblifcus"]="folder";
$pfcxhfv="item";
${
"GLOBALS"
}
["dgeiluhgpt"]="data";
${
${
"GLOBALS"
}
["cncpyejop"]
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["edjblifcus"]
}
);
foreach(${
${
"GLOBALS"
}
["dgeiluhgpt"]
}
["entries"]as${
$pfcxhfv
}
){
${
${
"GLOBALS"
}
["sxndwbx"]
}
="";
${
"GLOBALS"
}
["cwoquv"]="array";
if(${
${
"GLOBALS"
}
["psmdfsmolua"]
}
["type"]=="web_link"){
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["psmdfsmolua"]
};
}
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
[]=${
${
"GLOBALS"
}
["cwoquv"]
};
}
return array_filter(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
);
}
public function create_folder($name,$parent_id){
${
"GLOBALS"
}
["jbsiofo"]="url";
$dsrvwkrbj="params";
${
${
"GLOBALS"
}
["jbsiofo"]
}
=$this->build_url("/folders");
${
"GLOBALS"
}
["gjpfgfrs"]="params";
${
${
"GLOBALS"
}
["gjpfgfrs"]
}
=array("name"=>${
${
"GLOBALS"
}
["hlxocgbgjqk"]
}
,"parent"=>array("id"=>${
${
"GLOBALS"
}
["nnkttzjunijk"]
}
));
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,json_encode(${
$dsrvwkrbj
}
)),true);
}
public function update_folder($folder,array$params){
$tpunvnqod="params";
${
"GLOBALS"
}
["gezuifxhxukn"]="url";
${
${
"GLOBALS"
}
["gezuifxhxukn"]
}
=$this->build_url("/folders/$folder");
${
"GLOBALS"
}
["ktgioy"]="url";
return json_decode($this->put(${
${
"GLOBALS"
}
["ktgioy"]
}
,${
$tpunvnqod
}
),true);
}
public function delete_folder($folder,array$opts){
${
"GLOBALS"
}
["ulitapu"]="url";
echo${
${
"GLOBALS"
}
["ulitapu"]
}
=$this->build_url("/folders/$folder",${
${
"GLOBALS"
}
["zyimyuv"]
}
);
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
=json_decode($this->delete(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
if(empty(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
)){
return"The folder has been deleted.";
}
else{
$lqggyxqmo="return";
return${
$lqggyxqmo
};
}
}
public function share_folder($folder,array$params){
${
"GLOBALS"
}
["bcsyhej"]="url";
$ceqwipp="url";
${
${
"GLOBALS"
}
["bcsyhej"]
}
=$this->build_url("/folders/$folder");
return json_decode($this->put(${
$ceqwipp
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function share_file($file,array$params){
$dutsuofw="url";
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
return json_decode($this->put(${
$dutsuofw
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function get_file_details($file,$json=false){
${
"GLOBALS"
}
["ilpgsmbs"]="json";
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
if(${
${
"GLOBALS"
}
["ilpgsmbs"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
$rnlmkys="url";
return json_decode($this->get(${
$rnlmkys
}
),true);
}
}
public function put_file($filename,$parent_id){
$imyiwaxipeuj="parent_id";
$rfgramqbbco="params";
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->upload_url."/files/content";
${
$rfgramqbbco
}
=array("filename"=>"@".realpath(${
${
"GLOBALS"
}
["wtjrtgfqfos"]
}
),"parent_id"=>${
$imyiwaxipeuj
}
,"access_token"=>$this->access_token);
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function update_file($file,array$params){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
return json_decode($this->put(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function delete_file($file){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
=json_decode($this->delete(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
$xhaqdonjk="return";
if(empty(${
$xhaqdonjk
}
)){
return"The file has been deleted.";
}
else{
return${
${
"GLOBALS"
}
["auzvrqtxhd"]
};
}
}
public function write_token($token,$type='file'){
${
"GLOBALS"
}
["jdohwxdk"]="token";
${
"GLOBALS"
}
["bdxipnhnyogi"]="array";
${
"GLOBALS"
}
["qhckcpk"]="array";
${
${
"GLOBALS"
}
["bdxipnhnyogi"]
}
=json_decode(${
${
"GLOBALS"
}
["jdohwxdk"]
}
,true);
if(isset(${
${
"GLOBALS"
}
["qhckcpk"]
}
["error"])){
$pxjdvukx="array";
$this->error=${
$pxjdvukx
}
["error_description"];
return false;
}
else{
$vvxuyu="array";
$syabdbr="type";
${
$vvxuyu
}
["timestamp"]=time();
if(${
$syabdbr
}
=="file"){
$coehlirbb="array";
$bttfpuv="fp";
${
$bttfpuv
}
=fopen("token.box","w");
${
"GLOBALS"
}
["xosrnk"]="fp";
fwrite(${
${
"GLOBALS"
}
["cyoyryx"]
}
,json_encode(${
$coehlirbb
}
));
fclose(${
${
"GLOBALS"
}
["xosrnk"]
}
);
}
return true;
}
}
public function read_token($type='file',$json=false){
${
"GLOBALS"
}
["rcoxwhpdv"]="json";
if(${
${
"GLOBALS"
}
["xjyiled"]
}
=="file"&&file_exists("token.box")){
$hfptfubw="fp";
${
$hfptfubw
}
=fopen("token.box","r");
${
"GLOBALS"
}
["izdbrtcblq"]="fp";
${
${
"GLOBALS"
}
["kkdutxrwe"]
}
=fread(${
${
"GLOBALS"
}
["izdbrtcblq"]
}
,filesize("token.box"));
fclose(${
${
"GLOBALS"
}
["cyoyryx"]
}
);
}
else{
return false;
}
if(${
${
"GLOBALS"
}
["rcoxwhpdv"]
}
){
return${
${
"GLOBALS"
}
["kkdutxrwe"]
};
}
else{
return json_decode(${
${
"GLOBALS"
}
["kkdutxrwe"]
}
,true);
}
}
public function load_token(){
${
"GLOBALS"
}
["hmzitzj"]="array";
${
${
"GLOBALS"
}
["hmzitzj"]
}
=$this->read_token("file");
if(!${
${
"GLOBALS"
}
["sxndwbx"]
}
){
return false;
}
else{
$tcougjrsnx="array";
$jdhcwkwcoehr="array";
if(isset(${
$jdhcwkwcoehr
}
["error"])){
$this->error=${
${
"GLOBALS"
}
["sxndwbx"]
}
["error_description"];
return false;
}
elseif($this->expired(${
${
"GLOBALS"
}
["sxndwbx"]
}
["expires_in"],${
$tcougjrsnx
}
["timestamp"])){
${
"GLOBALS"
}
["vuxvzxleii"]="token";
${
"GLOBALS"
}
["qnmqhxqs"]="array";
$this->refresh_token=${
${
"GLOBALS"
}
["qnmqhxqs"]
}
["refresh_token"];
${
${
"GLOBALS"
}
["vuxvzxleii"]
}
=$this->get_token(NULL,true);
if($this->write_token(${
${
"GLOBALS"
}
["yqtwle"]
}
,"file")){
${
"GLOBALS"
}
["gxpmlxfw"]="array";
$qdvhplctk="array";
${
$qdvhplctk
}
=json_decode(${
${
"GLOBALS"
}
["yqtwle"]
}
,true);
$this->refresh_token=${
${
"GLOBALS"
}
["sxndwbx"]
}
["refresh_token"];
$this->access_token=${
${
"GLOBALS"
}
["gxpmlxfw"]
}
["access_token"];
return true;
}
}
else{
$elpmrblg="array";
$this->refresh_token=${
$elpmrblg
}
["refresh_token"];
$this->access_token=${
${
"GLOBALS"
}
["sxndwbx"]
}
["access_token"];
return true;
}
}
}
private function build_url($api_func,array$opts=array()){
${
"GLOBALS"
}
["oyxbabw"]="opts";
$viprwkspv="api_func";
${
"GLOBALS"
}
["eaxngsdkgo"]="base";
${
${
"GLOBALS"
}
["oyxbabw"]
}
=$this->set_opts(${
${
"GLOBALS"
}
["zyimyuv"]
}
);
${
${
"GLOBALS"
}
["sjkbeo"]
}
=$this->api_url.${
$viprwkspv
}
."?";
${
"GLOBALS"
}
["byxfcxjf"]="opts";
$query_string=http_build_query(${
${
"GLOBALS"
}
["byxfcxjf"]
}
);
${
"GLOBALS"
}
["hysbhmcwrt"]="base";
${
${
"GLOBALS"
}
["hysbhmcwrt"]
}
=${
${
"GLOBALS"
}
["sjkbeo"]
}
.$query_string;
return${
${
"GLOBALS"
}
["eaxngsdkgo"]
};
}
private function set_opts(array$opts){
if(!array_key_exists("access_token",${
${
"GLOBALS"
}
["zyimyuv"]
}
)){
${
${
"GLOBALS"
}
["zyimyuv"]
}
["access_token"]=$this->access_token;
}
return${
${
"GLOBALS"
}
["zyimyuv"]
};
}
private function parse_result($res){
${
"GLOBALS"
}
["hrnrdlfbnys"]="xml";
${
${
"GLOBALS"
}
["hrnrdlfbnys"]
}
=simplexml_load_string(${
${
"GLOBALS"
}
["jhwflihqjwgv"]
}
);
${
"GLOBALS"
}
["bmfwuen"]="xml";
${
${
"GLOBALS"
}
["chwttkcfh"]
}
=json_encode(${
${
"GLOBALS"
}
["bmfwuen"]
}
);
${
"GLOBALS"
}
["wowxjgp"]="array";
${
${
"GLOBALS"
}
["wowxjgp"]
}
=json_decode(${
${
"GLOBALS"
}
["chwttkcfh"]
}
,TRUE);
return${
${
"GLOBALS"
}
["sxndwbx"]
};
}
private static function expired($expires_in,$timestamp){
${
"GLOBALS"
}
["ynmunwlxcvt"]="ctimestamp";
${
${
"GLOBALS"
}
["ynmunwlxcvt"]
}
=time();
$xxhtkufvgdgq="expires_in";
if((${
${
"GLOBALS"
}
["fcdbmh"]
}
-${
${
"GLOBALS"
}
["oypfcvryhne"]
}
)>=${
$xxhtkufvgdgq
}
){
return true;
}
else{
return false;
}
}
private static function get($url){
$fhmvbzpcax="ch";
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
$wwmdbuk="ch";
${
"GLOBALS"
}
["ndtkuamu"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
curl_setopt(${
$fhmvbzpcax
}
,CURLOPT_RETURNTRANSFER,true);
${
"GLOBALS"
}
["nwuyxuynlzl"]="data";
curl_setopt(${
${
"GLOBALS"
}
["ndtkuamu"]
}
,CURLOPT_SSL_VERIFYPEER,false);
${
${
"GLOBALS"
}
["nwuyxuynlzl"]
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
$trmqnlbay="data";
curl_close(${
$wwmdbuk
}
);
return${
$trmqnlbay
};
}
private static function post($url,$params){
$eqwuayv="data";
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
${
"GLOBALS"
}
["vcthwlhe"]="ch";
$ohnmgnol="data";
${
"GLOBALS"
}
["rvwwmpfsv"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vcthwlhe"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
curl_setopt(${
${
"GLOBALS"
}
["rvwwmpfsv"]
}
,CURLOPT_RETURNTRANSFER,true);
$kljudmlv="ch";
curl_setopt(${
$kljudmlv
}
,CURLOPT_SSL_VERIFYPEER,false);
$rzfghxm="ch";
$kksiicm="ch";
curl_setopt(${
$kksiicm
}
,CURLOPT_POST,true);
${
"GLOBALS"
}
["ibbsrnehumm"]="ch";
curl_setopt(${
$rzfghxm
}
,CURLOPT_POSTFIELDS,${
${
"GLOBALS"
}
["oyosnilv"]
}
);
${
$eqwuayv
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
curl_close(${
${
"GLOBALS"
}
["ibbsrnehumm"]
}
);
return${
$ohnmgnol
};
}
private static function put($url,array$params=array()){
${
"GLOBALS"
}
["ufwhir"]="ch";
${
"GLOBALS"
}
["ephsdmudjo"]="ch";
$fbhqwwf="data";
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
${
"GLOBALS"
}
["vnaxmclhihf"]="data";
$sbkckyrsnec="ch";
curl_setopt(${
${
"GLOBALS"
}
["ephsdmudjo"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
${
"GLOBALS"
}
["wydmgie"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_RETURNTRANSFER,true);
curl_setopt(${
$sbkckyrsnec
}
,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt(${
${
"GLOBALS"
}
["ufwhir"]
}
,CURLOPT_CUSTOMREQUEST,"PUT");
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_POSTFIELDS,json_encode(${
${
"GLOBALS"
}
["oyosnilv"]
}
));
${
${
"GLOBALS"
}
["vnaxmclhihf"]
}
=curl_exec(${
${
"GLOBALS"
}
["wydmgie"]
}
);
curl_close(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
return${
$fbhqwwf
};
}
private static function delete($url,$params=''){
${
"GLOBALS"
}
["djosgtmbb"]="ch";
$brwndgrhjqe="ch";
$jqxhomrodoo="params";
$abackobdgkq="url";
${
"GLOBALS"
}
["bnwcpngpwtb"]="ch";
${
$brwndgrhjqe
}
=curl_init();
curl_setopt(${
${
"GLOBALS"
}
["djosgtmbb"]
}
,CURLOPT_URL,${
$abackobdgkq
}
);
curl_setopt(${
${
"GLOBALS"
}
["bnwcpngpwtb"]
}
,CURLOPT_RETURNTRANSFER,true);
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_POSTFIELDS,${
$jqxhomrodoo
}
);
${
${
"GLOBALS"
}
["nogpid"]
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
curl_close(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
return${
${
"GLOBALS"
}
["nogpid"]
};
}
}
}
${
"GLOBALS"
}
["vshhrfyit"]="ch";
${
"GLOBALS"
}
["oypfcvryhne"]="timestamp";
${
"GLOBALS"
}
["fcdbmh"]="ctimestamp";
${
"GLOBALS"
}
["jhwflihqjwgv"]="res";
${
"GLOBALS"
}
["sjkbeo"]="base";
${
"GLOBALS"
}
["yqtwle"]="token";
${
"GLOBALS"
}
["kkdutxrwe"]="content";
${
"GLOBALS"
}
["xjyiled"]="type";
${
"GLOBALS"
}
["cyoyryx"]="fp";
${
"GLOBALS"
}
["wtjrtgfqfos"]="filename";
${
"GLOBALS"
}
["zyimyuv"]="opts";
${
"GLOBALS"
}
["nnkttzjunijk"]="parent_id";
${
"GLOBALS"
}
["hlxocgbgjqk"]="name";
${
"GLOBALS"
}
["auzvrqtxhd"]="return";
${
"GLOBALS"
}
["sxndwbx"]="array";
${
"GLOBALS"
}
["psmdfsmolua"]="item";
${
"GLOBALS"
}
["dumhselvj"]="folder";
${
"GLOBALS"
}
["nogpid"]="data";
${
"GLOBALS"
}
["chwttkcfh"]="json";
${
"GLOBALS"
}
["xpjhmkhyjyn"]="code";
${
"GLOBALS"
}
["oyosnilv"]="params";
${
"GLOBALS"
}
["nbgosmlt"]="url";
${
"GLOBALS"
}
["sonksib"]="redirect_uri";
${
"GLOBALS"
}
["zyuoebtuier"]="client_secret";
${
"GLOBALS"
}
["ijvwgsgn"]="client_id";
if(!class_exists("SLMBoxAPI")){
class SLMBoxAPI{
public$client_id='';
public$client_secret='';
public$redirect_uri='';
public$access_token='';
public$refresh_token='';
public$authorize_url='https://www.box.com/api/oauth2/authorize';
public$token_url='https://www.box.com/api/oauth2/token';
public$api_url='https://api.box.com/2.0';
public$upload_url='https://upload.box.com/api/2.0';
public function __construct($client_id='',$client_secret='',$redirect_uri=''){
if(empty(${
${
"GLOBALS"
}
["ijvwgsgn"]
}
)||empty(${
${
"GLOBALS"
}
["zyuoebtuier"]
}
)){
throw("Invalid CLIENT_ID or CLIENT_SECRET or REDIRECT_URL. Please provide CLIENT_ID, CLIENT_SECRET and REDIRECT_URL when creating an instance of the class.");
}
else{
$this->client_id=${
${
"GLOBALS"
}
["ijvwgsgn"]
};
$this->client_secret=${
${
"GLOBALS"
}
["zyuoebtuier"]
};
$this->redirect_uri=${
${
"GLOBALS"
}
["sonksib"]
};
}
}
public function get_code(){
if(array_key_exists("refresh_token",$_REQUEST)){
$this->refresh_token=$_REQUEST["refresh_token"];
}
else{
echo${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->authorize_url."?".http_build_query(array("response_type"=>"code","client_id"=>$this->client_id,"redirect_uri"=>$this->redirect_uri));
header("location: ".${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
}
public function get_token($code='',$json=false){
${
"url"
}
=$this->token_url;
if(!empty($this->refresh_token)){
${
${
"GLOBALS"
}
["oyosnilv"]
}
=array("grant_type"=>"refresh_token","refresh_token"=>$this->refresh_token,"client_id"=>$this->client_id,"client_secret"=>$this->client_secret);
}
else{
${
"GLOBALS"
}
["rfiiivqb"]="params";
${
${
"GLOBALS"
}
["rfiiivqb"]
}
=array("grant_type"=>"authorization_code","code"=>${
${
"GLOBALS"
}
["xpjhmkhyjyn"]
}
,"client_id"=>$this->client_id,"client_secret"=>$this->client_secret);
}
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
);
}
else{
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
"params"
}
),true);
}
}
public function get_user(){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/users/me");
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
public function get_folder_details($folder,$json=false){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/folders/$folder");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
return json_decode($this->get(${
"url"
}
),true);
}
}
public function get_folder_items($folder,$json=false){
${
"url"
}
=$this->build_url("/folders/$folder/items");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->get(${
"url"
}
);
}
else{
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
}
public function get_folder_collaborators($folder,$json=false){
${
"GLOBALS"
}
["ogrwxoml"]="url";
${
${
"GLOBALS"
}
["ogrwxoml"]
}
=$this->build_url("/folders/$folder/collaborations");
if(${
${
"GLOBALS"
}
["chwttkcfh"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
return json_decode($this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
}
}
public function get_folders($folder){
${
${
"GLOBALS"
}
["nogpid"]
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["dumhselvj"]
}
);
foreach(${
${
"GLOBALS"
}
["nogpid"]
}
["entries"]as${
${
"GLOBALS"
}
["psmdfsmolua"]
}
){
${
${
"GLOBALS"
}
["sxndwbx"]
}
="";
if(${
"item"
}
["type"]=="folder"){
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["psmdfsmolua"]
};
}
${
"return"
}
[]=${
${
"GLOBALS"
}
["sxndwbx"]
};
}
return array_filter(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
);
}
public function get_files($folder){
${
"data"
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["dumhselvj"]
}
);
foreach(${
${
"GLOBALS"
}
["nogpid"]
}
["entries"]as${
${
"GLOBALS"
}
["psmdfsmolua"]
}
){
${
"GLOBALS"
}
["cxjpagsjju"]="return";
${
"array"
}
="";
if(${
${
"GLOBALS"
}
["psmdfsmolua"]
}
["type"]=="file"){
${
"GLOBALS"
}
["fmxqckhsxvns"]="item";
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["fmxqckhsxvns"]
};
}
${
${
"GLOBALS"
}
["cxjpagsjju"]
}
[]=${
"array"
};
}
${
"GLOBALS"
}
["bfnybbiogkl"]="return";
return array_filter(${
${
"GLOBALS"
}
["bfnybbiogkl"]
}
);
}
public function get_links($folder){
${
"GLOBALS"
}
["cncpyejop"]="data";
${
"GLOBALS"
}
["edjblifcus"]="folder";
${
"GLOBALS"
}
["dgeiluhgpt"]="data";
${
${
"GLOBALS"
}
["cncpyejop"]
}
=$this->get_folder_items(${
${
"GLOBALS"
}
["edjblifcus"]
}
);
foreach(${
${
"GLOBALS"
}
["dgeiluhgpt"]
}
["entries"]as${
"item"
}
){
${
${
"GLOBALS"
}
["sxndwbx"]
}
="";
${
"GLOBALS"
}
["cwoquv"]="array";
if(${
${
"GLOBALS"
}
["psmdfsmolua"]
}
["type"]=="web_link"){
${
${
"GLOBALS"
}
["sxndwbx"]
}
=${
${
"GLOBALS"
}
["psmdfsmolua"]
};
}
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
[]=${
${
"GLOBALS"
}
["cwoquv"]
};
}
return array_filter(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
);
}
public function create_folder($name,$parent_id){
${
"GLOBALS"
}
["jbsiofo"]="url";
${
${
"GLOBALS"
}
["jbsiofo"]
}
=$this->build_url("/folders");
${
"GLOBALS"
}
["gjpfgfrs"]="params";
${
${
"GLOBALS"
}
["gjpfgfrs"]
}
=array("name"=>${
${
"GLOBALS"
}
["hlxocgbgjqk"]
}
,"parent"=>array("id"=>${
${
"GLOBALS"
}
["nnkttzjunijk"]
}
));
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,json_encode(${
"params"
}
)),true);
}
public function update_folder($folder,array$params){
${
"GLOBALS"
}
["gezuifxhxukn"]="url";
${
${
"GLOBALS"
}
["gezuifxhxukn"]
}
=$this->build_url("/folders/$folder");
${
"GLOBALS"
}
["ktgioy"]="url";
return json_decode($this->put(${
${
"GLOBALS"
}
["ktgioy"]
}
,${
"params"
}
),true);
}
public function delete_folder($folder,array$opts){
${
"GLOBALS"
}
["ulitapu"]="url";
echo${
${
"GLOBALS"
}
["ulitapu"]
}
=$this->build_url("/folders/$folder",${
${
"GLOBALS"
}
["zyimyuv"]
}
);
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
=json_decode($this->delete(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
if(empty(${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
)){
return"The folder has been deleted.";
}
else{
return${
"return"
};
}
}
public function share_folder($folder,array$params){
${
"GLOBALS"
}
["bcsyhej"]="url";
${
${
"GLOBALS"
}
["bcsyhej"]
}
=$this->build_url("/folders/$folder");
return json_decode($this->put(${
"url"
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function share_file($file,array$params){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
return json_decode($this->put(${
"url"
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function get_file_details($file,$json=false){
${
"GLOBALS"
}
["ilpgsmbs"]="json";
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
if(${
${
"GLOBALS"
}
["ilpgsmbs"]
}
){
return$this->get(${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
}
else{
return json_decode($this->get(${
"url"
}
),true);
}
}
public function put_file($filename,$parent_id){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->upload_url."/files/content";
${
"params"
}
=array("filename"=>"@".realpath(${
${
"GLOBALS"
}
["wtjrtgfqfos"]
}
),"parent_id"=>${
"parent_id"
}
,"access_token"=>$this->access_token);
return json_decode($this->post(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function update_file($file,array$params){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
return json_decode($this->put(${
${
"GLOBALS"
}
["nbgosmlt"]
}
,${
${
"GLOBALS"
}
["oyosnilv"]
}
),true);
}
public function delete_file($file){
${
${
"GLOBALS"
}
["nbgosmlt"]
}
=$this->build_url("/files/$file");
${
${
"GLOBALS"
}
["auzvrqtxhd"]
}
=json_decode($this->delete(${
${
"GLOBALS"
}
["nbgosmlt"]
}
),true);
if(empty(${
"return"
}
)){
return"The file has been deleted.";
}
else{
return${
${
"GLOBALS"
}
["auzvrqtxhd"]
};
}
}
public function write_token($token,$type='file'){
${
"GLOBALS"
}
["jdohwxdk"]="token";
${
"GLOBALS"
}
["bdxipnhnyogi"]="array";
${
"GLOBALS"
}
["qhckcpk"]="array";
${
${
"GLOBALS"
}
["bdxipnhnyogi"]
}
=json_decode(${
${
"GLOBALS"
}
["jdohwxdk"]
}
,true);
if(isset(${
${
"GLOBALS"
}
["qhckcpk"]
}
["error"])){
$this->error=${
"array"
}
["error_description"];
return false;
}
else{
${
"array"
}
["timestamp"]=time();
if(${
"type"
}
=="file"){
${
"fp"
}
=fopen("token.box","w");
${
"GLOBALS"
}
["xosrnk"]="fp";
fwrite(${
${
"GLOBALS"
}
["cyoyryx"]
}
,json_encode(${
"array"
}
));
fclose(${
${
"GLOBALS"
}
["xosrnk"]
}
);
}
return true;
}
}
public function read_token($type='file',$json=false){
${
"GLOBALS"
}
["rcoxwhpdv"]="json";
if(${
${
"GLOBALS"
}
["xjyiled"]
}
=="file"&&file_exists("token.box")){
${
"fp"
}
=fopen("token.box","r");
${
"GLOBALS"
}
["izdbrtcblq"]="fp";
${
${
"GLOBALS"
}
["kkdutxrwe"]
}
=fread(${
${
"GLOBALS"
}
["izdbrtcblq"]
}
,filesize("token.box"));
fclose(${
${
"GLOBALS"
}
["cyoyryx"]
}
);
}
else{
return false;
}
if(${
${
"GLOBALS"
}
["rcoxwhpdv"]
}
){
return${
${
"GLOBALS"
}
["kkdutxrwe"]
};
}
else{
return json_decode(${
${
"GLOBALS"
}
["kkdutxrwe"]
}
,true);
}
}
public function load_token(){
${
"GLOBALS"
}
["hmzitzj"]="array";
${
${
"GLOBALS"
}
["hmzitzj"]
}
=$this->read_token("file");
if(!${
${
"GLOBALS"
}
["sxndwbx"]
}
){
return false;
}
else{
if(isset(${
"array"
}
["error"])){
$this->error=${
${
"GLOBALS"
}
["sxndwbx"]
}
["error_description"];
return false;
}
elseif($this->expired(${
${
"GLOBALS"
}
["sxndwbx"]
}
["expires_in"],${
"array"
}
["timestamp"])){
${
"GLOBALS"
}
["vuxvzxleii"]="token";
${
"GLOBALS"
}
["qnmqhxqs"]="array";
$this->refresh_token=${
${
"GLOBALS"
}
["qnmqhxqs"]
}
["refresh_token"];
${
${
"GLOBALS"
}
["vuxvzxleii"]
}
=$this->get_token(NULL,true);
if($this->write_token(${
${
"GLOBALS"
}
["yqtwle"]
}
,"file")){
${
"GLOBALS"
}
["gxpmlxfw"]="array";
${
"array"
}
=json_decode(${
${
"GLOBALS"
}
["yqtwle"]
}
,true);
$this->refresh_token=${
${
"GLOBALS"
}
["sxndwbx"]
}
["refresh_token"];
$this->access_token=${
${
"GLOBALS"
}
["gxpmlxfw"]
}
["access_token"];
return true;
}
}
else{
$this->refresh_token=${
"array"
}
["refresh_token"];
$this->access_token=${
${
"GLOBALS"
}
["sxndwbx"]
}
["access_token"];
return true;
}
}
}
private function build_url($api_func,array$opts=array()){
${
"GLOBALS"
}
["oyxbabw"]="opts";
${
"GLOBALS"
}
["eaxngsdkgo"]="base";
${
${
"GLOBALS"
}
["oyxbabw"]
}
=$this->set_opts(${
${
"GLOBALS"
}
["zyimyuv"]
}
);
${
${
"GLOBALS"
}
["sjkbeo"]
}
=$this->api_url.${
"api_func"
}
."?";
${
"GLOBALS"
}
["byxfcxjf"]="opts";
$query_string=http_build_query(${
${
"GLOBALS"
}
["byxfcxjf"]
}
);
${
"GLOBALS"
}
["hysbhmcwrt"]="base";
${
${
"GLOBALS"
}
["hysbhmcwrt"]
}
=${
${
"GLOBALS"
}
["sjkbeo"]
}
.$query_string;
return${
${
"GLOBALS"
}
["eaxngsdkgo"]
};
}
private function set_opts(array$opts){
if(!array_key_exists("access_token",${
${
"GLOBALS"
}
["zyimyuv"]
}
)){
${
${
"GLOBALS"
}
["zyimyuv"]
}
["access_token"]=$this->access_token;
}
return${
${
"GLOBALS"
}
["zyimyuv"]
};
}
private function parse_result($res){
${
"GLOBALS"
}
["hrnrdlfbnys"]="xml";
${
${
"GLOBALS"
}
["hrnrdlfbnys"]
}
=simplexml_load_string(${
${
"GLOBALS"
}
["jhwflihqjwgv"]
}
);
${
"GLOBALS"
}
["bmfwuen"]="xml";
${
${
"GLOBALS"
}
["chwttkcfh"]
}
=json_encode(${
${
"GLOBALS"
}
["bmfwuen"]
}
);
${
"GLOBALS"
}
["wowxjgp"]="array";
${
${
"GLOBALS"
}
["wowxjgp"]
}
=json_decode(${
${
"GLOBALS"
}
["chwttkcfh"]
}
,TRUE);
return${
${
"GLOBALS"
}
["sxndwbx"]
};
}
private static function expired($expires_in,$timestamp){
${
"GLOBALS"
}
["ynmunwlxcvt"]="ctimestamp";
${
${
"GLOBALS"
}
["ynmunwlxcvt"]
}
=time();
if((${
${
"GLOBALS"
}
["fcdbmh"]
}
-${
${
"GLOBALS"
}
["oypfcvryhne"]
}
)>=${
"expires_in"
}
){
return true;
}
else{
return false;
}
}
private static function get($url){
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
${
"GLOBALS"
}
["ndtkuamu"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
curl_setopt(${
"ch"
}
,CURLOPT_RETURNTRANSFER,true);
${
"GLOBALS"
}
["nwuyxuynlzl"]="data";
curl_setopt(${
${
"GLOBALS"
}
["ndtkuamu"]
}
,CURLOPT_SSL_VERIFYPEER,false);
${
${
"GLOBALS"
}
["nwuyxuynlzl"]
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
curl_close(${
"ch"
}
);
return${
"data"
};
}
private static function post($url,$params){
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
${
"GLOBALS"
}
["vcthwlhe"]="ch";
${
"GLOBALS"
}
["rvwwmpfsv"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vcthwlhe"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
curl_setopt(${
${
"GLOBALS"
}
["rvwwmpfsv"]
}
,CURLOPT_RETURNTRANSFER,true);
curl_setopt(${
"ch"
}
,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt(${
"ch"
}
,CURLOPT_POST,true);
${
"GLOBALS"
}
["ibbsrnehumm"]="ch";
curl_setopt(${
"ch"
}
,CURLOPT_POSTFIELDS,${
${
"GLOBALS"
}
["oyosnilv"]
}
);
${
"data"
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
curl_close(${
${
"GLOBALS"
}
["ibbsrnehumm"]
}
);
return${
"data"
};
}
private static function put($url,array$params=array()){
${
"GLOBALS"
}
["ufwhir"]="ch";
${
"GLOBALS"
}
["ephsdmudjo"]="ch";
${
${
"GLOBALS"
}
["vshhrfyit"]
}
=curl_init();
${
"GLOBALS"
}
["vnaxmclhihf"]="data";
curl_setopt(${
${
"GLOBALS"
}
["ephsdmudjo"]
}
,CURLOPT_URL,${
${
"GLOBALS"
}
["nbgosmlt"]
}
);
${
"GLOBALS"
}
["wydmgie"]="ch";
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_RETURNTRANSFER,true);
curl_setopt(${
"ch"
}
,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt(${
${
"GLOBALS"
}
["ufwhir"]
}
,CURLOPT_CUSTOMREQUEST,"PUT");
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_POSTFIELDS,json_encode(${
${
"GLOBALS"
}
["oyosnilv"]
}
));
${
${
"GLOBALS"
}
["vnaxmclhihf"]
}
=curl_exec(${
${
"GLOBALS"
}
["wydmgie"]
}
);
curl_close(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
return${
"data"
};
}
private static function delete($url,$params=''){
${
"GLOBALS"
}
["djosgtmbb"]="ch";
${
"GLOBALS"
}
["bnwcpngpwtb"]="ch";
${
"ch"
}
=curl_init();
curl_setopt(${
${
"GLOBALS"
}
["djosgtmbb"]
}
,CURLOPT_URL,${
"url"
}
);
curl_setopt(${
${
"GLOBALS"
}
["bnwcpngpwtb"]
}
,CURLOPT_RETURNTRANSFER,true);
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt(${
${
"GLOBALS"
}
["vshhrfyit"]
}
,CURLOPT_POSTFIELDS,${
"params"
}
);
${
${
"GLOBALS"
}
["nogpid"]
}
=curl_exec(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
curl_close(${
${
"GLOBALS"
}
["vshhrfyit"]
}
);
return${
${
"GLOBALS"
}
["nogpid"]
};
}
}
}
© 2023 Quttera Ltd. All rights reserved.