Example #1
0
 if ($_POST['package-method'] == "upload") {
     $cbx = array($random_dir);
 } else {
     if ($_POST['package-method'] == "package") {
         $cbx = array();
         foreach ($_POST as $post => $v) {
             if (preg_match("/cbx_/", $post) > 0) {
                 $cbx[] = preg_replace("/cbx_/", "", $post);
             }
         }
         if (isset($_POST['rdo_files'])) {
             $cbx[] = $_POST['rdo_files'];
         }
     }
 }
 $ret = associatePackages($p_api_id, $pid, $cbx, $level);
 if (!isXMLRPCError() and is_array($ret)) {
     if ($ret[0]) {
         $explain = '';
         if (count($ret) > 1) {
             $explain = sprintf(" : <br/>%s", implode("<br/>", $ret[1]));
         }
         new NotifyWidgetSuccess(sprintf(_T("Files successfully associated with package <b>%s (%s)</b>%s", "pkgs"), $plabel, $pversion, $explain));
         header("Location: " . urlStrRedirect("pkgs/pkgs/index", array('location' => base64_encode($p_api_id))));
         exit;
     } else {
         $reason = '';
         if (count($ret) > 1) {
             $reason = sprintf(" : <br/>%s", $ret[1]);
         }
         new NotifyWidgetFailure(sprintf(_T("Failed to associate files%s", "pkgs"), $reason));
Example #2
0
     #new NotifyWidgetSuccess(sprintf(_T("Package successfully added in %s", "pkgs"), $ret[2]));
     if (!isset($_POST["bassoc"])) {
         header("Location: " . urlStrRedirect("pkgs/pkgs/index", array('location' => base64_encode($p_api_id))));
         # TODO add params to go on the good p_api
         exit;
     }
 } else {
     new NotifyWidgetSuccess(_T("Package successfully edited", "pkgs"));
     $package = $ret[3];
 }
 $pid = $package['id'];
 $cbx = array($_POST['random_dir']);
 // If there is uploaded files to associate
 if ($_POST['files_uploaded']) {
     // === BEGIN ASSOCIATING FILES ==========================
     $ret = associatePackages($p_api_id, $pid, $cbx, 1);
     if (!isXMLRPCError() and is_array($ret)) {
         if ($ret[0]) {
             $explain = '';
             if (count($ret) > 1) {
                 $explain = sprintf(" : <br/>%s", implode("<br/>", $ret[1]));
             }
             new NotifyWidgetSuccess(sprintf(_T("Files successfully added to the package <b>%s (%s)</b>", "pkgs"), $plabel, $pversion));
             header("Location: " . urlStrRedirect("pkgs/pkgs/index", array('location' => base64_encode($p_api_id))));
             exit;
         } else {
             $reason = '';
             if (count($ret) > 1) {
                 $reason = sprintf(" : <br/>%s", $ret[1]);
             }
             new NotifyWidgetFailure(sprintf(_T("Failed to associate files%s", "pkgs"), $reason));