Exemple #1
0
 function Patch()
 {
     $diff = $this->mainDiff(true);
     // request the diff
     $file = gp('gpfile');
     $dir = AppDir($this->row['application']) . "/tmp/";
     $fn = $dir . scFileName($file) . '.diff';
     file_put_contents($fn, $diff);
     $parms = "?gp_uid=" . SessionGet('remoteUID') . "&gp_pwd=" . SessionGet('remotePWD') . "&gp_page=a_codexfer" . "&gp_app=" . trim($this->row['application']) . "&gp_action=patch" . "&gpfile=" . urlencode($file);
     // Setup the file transfer
     $postData = array();
     //simulates <input type="file" name="file_name">
     $dir = $GLOBALS['AG']['dirs']['root'];
     $postData['file_name'] = "@" . $fn;
     $postData['submit'] = "UPLOAD";
     $url = $this->node['node_url'];
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://{$url}/andro/{$parms}");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
     $retval = curl_exec($ch);
     curl_close($ch);
     if (substr($retval, 0, 3) != 'OK:') {
         ErrorAdd($retval);
     } else {
         file_put_contents(AppDir($this->row['application']) . "/ref/{$file}", substr($retval, 3));
     }
 }
Exemple #2
0
function scBaseName($filespec)
{
    $filename = scFileName($filespec);
    $list = explode(".", $filename);
    if (count($list) > 1) {
        array_pop($list);
    }
    return implode(".", $list);
}