本文整理汇总了PHP中isXMLRPCError函数的典型用法代码示例。如果您正苦于以下问题:PHP isXMLRPCError函数的具体用法?PHP isXMLRPCError怎么用?PHP isXMLRPCError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isXMLRPCError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetDefaultMenu
function resetDefaultMenu($uuid)
{
$ret = xmlrpc_resetComputerBootMenu($uuid);
if (!isXMLRPCError() && $ret) {
new NotifyWidgetSuccess(sprintf(_T("Default menu has been successfully restored.", "imaging")));
}
}
示例2: auth_user
function auth_user($login, $pass)
{
global $conf;
global $error;
if ($login == "" || $pass == "") {
return false;
}
$param = array();
$param[] = $login;
$param[] = prepare_string($pass);
$ret = xmlCall("base.ldapAuth", $param);
if ($ret != "1") {
if (!isXMLRPCError()) {
$error = _("Invalid login");
}
return false;
}
$subscription = getSubscriptionInformation(true);
if ($subscription['is_subsscribed']) {
$msg = array();
if ($subscription['too_much_users']) {
$msg[] = _("users");
}
if ($subscription['too_much_computers']) {
$msg[] = _("computers");
}
if (count($msg) > 0) {
$warn = sprintf(_('WARNING: The number of registered %s is exceeding your license.'), implode($msg, _(' and ')));
new NotifyWidgetWarning($warn);
}
}
return true;
}
示例3: updateFailoverConfig
function updateFailoverConfig($FH)
{
global $result;
global $error;
setFailoverConfig($FH->getPostValue("primaryIp"), $FH->getPostValue("secondaryIp"), $FH->getPostValue("primaryPort"), $FH->getPostValue("secondaryPort"), $FH->getPostValue("delay"), $FH->getPostValue("update"), $FH->getPostValue("balance"), $FH->getPostValue("mclt"), $FH->getPostValue("split"));
if (!isXMLRPCError()) {
$result .= _T("Failover configuration updated.") . "<br />";
$result .= _T("You must restart DHCP services.") . "<br />";
} else {
$error .= _T("Failed to update the failover configuration.") . "<br />";
}
}
示例4: right_top_shortcuts_display
/*
* Display right top shortcuts menu
*/
right_top_shortcuts_display();
if (isset($_POST['bsync'])) {
if (isset($params['uuid'])) {
$ret = xmlrpc_synchroComputer($params['uuid']);
} else {
$ret = xmlrpc_synchroProfile($params['gid']);
}
// goto images list
if ($ret[0] and !isXMLRPCError()) {
/* insert notification code here if needed */
} elseif (!$ret[0] and !isXMLRPCError()) {
unset($_SESSION["imaging.isComputerInProfileRegistered_".$params['uuid']]);
unset($_SESSION["imaging.isComputerRegistered_".$params['uuid']]);
if (!xmlrpc_isComputerInProfileRegistered($params['uuid']) && !xmlrpc_isComputerRegistered($params['uuid'])) {
new NotifyWidgetFailure(sprintf(_T("This computer is no longer registered : %s", "imaging"), $params['uuid']));
header("Location: ".urlStrRedirect("base/computers/index", $params));
exit;
} else {
new NotifyWidgetFailure(sprintf(_T("Boot Menu Generation failed for : %s", "imaging"), implode(', ', $ret[1])));
}
}
}
if (isset($params['uuid'])) {
$_GET['type'] = '';
$_GET['target_uuid'] = $params['uuid'];
示例5: start_a_command
function start_a_command($proxy = array())
{
if ($_POST['editConvergence']) {
$changed_params = getChangedParams($_POST);
if ($changed_params == array('active')) {
print "We have to edit command....";
}
}
$error = "";
if (!check_date($_POST)) {
$error .= _T("Your start and end dates are not coherent, please check them.<br/>", "msc");
}
# should add some other tests on fields (like int are int? ...)
if ($error != '') {
new NotifyWidgetFailure($error);
complete_post();
$url = "base/computers/msctabs?";
foreach ($_GET as $k => $v) {
$url .= "{$v}={$k}";
}
header("Location: " . urlStrRedirect("msc/logs/viewLogs", array_merge($_GET, $_POST, array('failure' => True))));
exit;
}
// Vars seeding
$post = $_POST;
$from = $post['from'];
$path = explode('|', $from);
$module = $path[0];
$submod = $path[1];
$page = $path[2];
$params = array();
foreach (array('start_script', 'clean_on_success', 'do_reboot', 'do_wol', 'next_connection_delay', 'max_connection_attempt', 'do_inventory', 'ltitle', 'parameters', 'papi', 'maxbw', 'deployment_intervals', 'max_clients_per_proxy', 'launchAction') as $param) {
$params[$param] = $post[$param];
}
$halt_to = array();
foreach ($post as $p => $v) {
if (preg_match('/^issue_halt_to_/', $p)) {
$p = preg_replace('/^issue_halt_to_/', '', $p);
if ($v == 'on') {
$halt_to[] = $p;
}
}
}
$params['issue_halt_to'] = $halt_to;
$p_api = new ServerAPI();
$p_api->fromURI($post['papi']);
foreach (array('start_date', 'end_date') as $param) {
if ($post[$param] == _T("now", "msc")) {
$params[$param] = "0000-00-00 00:00:00";
} elseif ($post[$param] == _T("never", "msc")) {
$params[$param] = "0000-00-00 00:00:00";
} else {
$params[$param] = $post[$param];
}
}
$pid = $post['pid'];
$mode = $post['copy_mode'];
if (isset($post['uuid']) && $post['uuid']) {
// command on a single target
$hostname = $post['hostname'];
$uuid = $post['uuid'];
$target = array($uuid);
$tab = 'tablogs';
/* record new command */
$id = add_command_api($pid, $target, $params, $p_api, $mode, NULL);
if (!isXMLRPCError()) {
scheduler_start_these_commands('', array($id));
/* then redirect to the logs page */
header("Location: " . urlStrRedirect("msc/logs/viewLogs", array('tab' => $tab, 'uuid' => $uuid, 'hostname' => $hostname, 'cmd_id' => $id)));
exit;
} else {
/* Return to the launch tab, the backtrace will be displayed */
header("Location: " . urlStrRedirect("msc/logs/viewLogs", array('tab' => 'tablaunch', 'uuid' => $uuid, 'hostname' => $hostname)));
exit;
}
} else {
# command on a whole group
$gid = $post['gid'];
$tab = 'grouptablogs';
// record new command
// given a proxy list and a proxy style, we now have to build or proxy chain
// target structure is an dict using the following stucture: "priority" => array(proxies)
$ordered_proxies = array();
if ($_POST['proxy_mode'] == 'multiple') {
// first case: split mode; every proxy got the same priority (1 in our case)
foreach ($proxy as $p) {
array_push($ordered_proxies, array('uuid' => $p, 'priority' => 1, 'max_clients' => $_POST['max_clients_per_proxy']));
}
$params['proxy_mode'] = 'split';
} elseif ($_POST['proxy_mode'] == 'single') {
// second case: queue mode; one priority level per proxy, starting at 1
$current_priority = 1;
foreach ($proxy as $p) {
array_push($ordered_proxies, array('uuid' => $p, 'priority' => $current_priority, 'max_clients' => $_POST['max_clients_per_proxy']));
$current_priority += 1;
}
$params['proxy_mode'] = 'queue';
}
if (quick_get('convergence')) {
$active = $_POST['active'] == 'on' ? 1 : 0;
//.........这里部分代码省略.........
示例6: HiddenTpl
$f->add(new HiddenTpl("target_name"), array("value" => $target_name, "hide" => True));
$f->add(new HiddenTpl("type"), array("value" => $type, "hide" => True));
$f->pop();
$f->addButton("bunregister2", _T("Unregister this computer", 'imaging'));
$f->addButton("cancel", _T("Cancel", "imaging"), 'btnSecondary');
$f->display();
} else {
if (isset($_POST["bunregister2"])) {
$type = $_POST["type"];
$target_uuid = $_POST['target_uuid'];
$target_name = $_POST['target_name'];
$params['target_uuid'] = $target_uuid;
$params['target_name'] = $target_name;
$params['backup'] = $_POST['backup'];
$ret = xmlrpc_delComputersImaging(array($target_uuid), $params['backup'] ? true : false);
if ($ret[0] and !isXMLRPCError()) {
new NotifyWidgetSuccess(sprintf(_T("The computer %s has correctly been unregistered from imaging", 'imaging'), $target_name));
unset($_SESSION["imaging.isComputerRegistered_" . $target_uuid]);
header("Location: " . urlStrRedirect("base/computers/register_target", $params));
exit;
} else {
new NotifyWidgetFailure(sprintf(_T("Failed to unregister the computer %s", 'imaging'), $target_name));
}
$is_unregistering = True;
} else {
/*
* type: 'group' for a profile, '' for a single computer
*/
$type = $_GET["type"];
$target_uuid = $_GET['target_uuid'];
$target_name = $_GET['target_name'];
示例7: xmlCall
/**
* Make a XML-RPC call
* If the global variable $errorStatus is not zero, the XML-RPC call is not
* done, and this function returns nothing.
*
* @param $method name of the method
* @param $params array with param
* @return the XML-RPC call result
*/
function xmlCall($method, $params = null)
{
global $errorStatus;
global $errorDesc;
global $conf;
if (isXMLRPCError()) {
// Don't do a XML-RPC call if a previous one failed
return;
}
/*
Set defaut login/pass if not set.
The credentials are used to authenticate the web interface to the XML-RPC
server.
*/
if (!isset($conf["global"]["login"])) {
$conf["global"]["login"] = "mmc";
$conf["global"]["password"] = "s3cr3t";
}
$output_options = array("output_type" => "xml", "verbosity" => "pretty", "escaping" => array("markup"), "version" => "xmlrpc", "encoding" => "UTF-8");
$request = xmlrpc_encode_request($method, $params, $output_options);
/* We build the HTTP POST that will be sent */
$host = $_SESSION["XMLRPC_agent"]["host"] . ":" . $_SESSION["XMLRPC_agent"]["port"];
$url = "/";
$httpQuery = "POST " . $url . " HTTP/1.0\r\n";
$httpQuery .= "User-Agent: MMC web interface\r\n";
$httpQuery .= "Host: " . $host . "\r\n";
$httpQuery .= "Content-Type: text/xml\r\n";
$httpQuery .= "Content-Length: " . strlen($request) . "\r\n";
/* Don't set the RPC session cookie if the user is on the login page */
if ($method == "base.ldapAuth" || $method == "base.tokenAuthenticate") {
unset($_SESSION["RPCSESSION"]);
$httpQuery .= "X-Browser-IP: " . $_SERVER["REMOTE_ADDR"] . "\r\n";
$httpQuery .= "X-Browser-HOSTNAME: " . gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\r\n";
} else {
$httpQuery .= "Cookie: " . $_SESSION["RPCSESSION"] . "\r\n";
}
$httpQuery .= "Authorization: Basic " . base64_encode($conf["global"]["login"] . ":" . $conf["global"]["password"]) . "\r\n\r\n";
$httpQuery .= $request;
$sock = null;
/* Connect to the XML-RPC server */
if ($_SESSION["XMLRPC_agent"]["scheme"] == "https") {
$prot = "ssl://";
} else {
$prot = "";
}
list($sock, $errNo, $errString) = openSocket($prot, $conf);
if (!$sock) {
/* Connection failure */
$errObj = new ErrorHandlingItem('');
$errObj->setMsg(_("Can't connect to MMC agent"));
$errObj->setAdvice(_("MMC agent seems to be down or not correctly configured.") . '<br/> Error: ' . $errNo . ' - ' . $errString);
$errObj->setTraceBackDisplay(false);
$errObj->setSize(400);
$errObj->process('');
$errorStatus = 1;
return FALSE;
}
/* Send the HTTP POST */
if (!fwrite($sock, $httpQuery, strlen($httpQuery))) {
/* Failure */
$errObj = new ErrorHandlingItem('');
$errObj->setMsg(_("Can't send XML-RPC request to MMC agent"));
$errObj->setAdvice(_("MMC agent seems to be not correctly configured."));
$errObj->setTraceBackDisplay(false);
$errObj->setSize(400);
$errObj->process('');
$errorStatus = 1;
return FALSE;
}
fflush($sock);
/* Get the response from the server */
$xmlResponse = '';
while (!feof($sock)) {
$ret = fread($sock, 8192);
$info = stream_get_meta_data($sock);
if ($info['timed_out']) {
$errObj = new ErrorHandlingItem('');
$errObj->setMsg(_('MMC agent communication problem'));
$errObj->setAdvice(_('Timeout when reading data from the MMC agent. Please check network connectivity and server load.'));
$errObj->setTraceBackDisplay(false);
$errObj->setSize(400);
$errObj->process('');
$errorStatus = 1;
return FALSE;
}
if ($ret === False) {
$errObj = new ErrorHandlingItem('');
$errObj->setMsg(_("Error while reading MMC agent XML-RPC response."));
$errObj->setAdvice(_("Please check network connectivity."));
$errObj->setTraceBackDisplay(false);
$errObj->setSize(400);
//.........这里部分代码省略.........
示例8: getCurrentLocation
# synchronization of locations
global $SYNCHROSTATE_UNKNOWN;
global $SYNCHROSTATE_TODO;
global $SYNCHROSTATE_SYNCHRO;
global $SYNCHROSTATE_RUNNING;
global $SYNCHROSTATE_INIT_ERROR;
$location = getCurrentLocation();
if (isset($_POST['bsync'])) {
$params['bsync'] = '1';
$ret = xmlrpc_synchroLocation($_POST['location_uuid']);
// goto images list
if ((is_array($ret) and $ret[0] or !is_array($ret) and $ret) and !isXMLRPCError()) {
/* insert notification code here if needed */
} elseif (!$ret[0] and !isXMLRPCError()) {
new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s<br /><br />Check /var/log/mmc/pulse2-package-server.log", "imaging"), implode(', ', $ret[1])));
} elseif (isXMLRPCError()) {
new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s<br /><br />Check /var/log/mmc/pulse2-package-server.log", "imaging"), implode(', ', $ret[1])));
}
}
# needed in the case we have to go back to the good list.
$params['from'] = $_GET['action'];
$params['module'] = $_GET['module'];
$params['submod'] = $_GET['submod'];
$params['action'] = $_GET['action'];
if (displayLocalisationBar()) {
$location = getCurrentLocation();
$ajax = new AjaxLocation("modules/imaging/manage/{$page}.php", "container_{$page}", "location", $params);
list($list, $values) = getEntitiesSelectableElements();
$ajax->setElements($list);
$ajax->setElementsVal($values);
if ($location) {
示例9: activateAppstreamFlow
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MMC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MMC; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once "modules/pkgs/includes/xmlrpc.php";
if (isset($_POST["bconfirm"])) {
activateAppstreamFlow($_POST['id'], $_POST['package_name'], $_POST['package_label'], $_POST['duration']);
if (!isXMLRPCError() and $ret != -1) {
new NotifyWidgetSuccess(_T("The stream has been added successfully. You will receive the latest updates of this stream directly in your package list.", "pkgs"));
}
if ($ret == -1) {
new NotifyWidgetFailure(_T("Unable to add stream.", "pkgs"));
}
header("Location: " . urlStrRedirect("pkgs/pkgs/appstreamSettings", array()));
exit;
} else {
$id = $_GET['id'];
$package_name = $_GET['package_name'];
$package_label = $_GET['package_label'];
$duration = $_GET['duration'];
$f = new PopupForm(_T("Activate this Appstream stream?"));
$hidden = new HiddenTpl("id");
$f->add($hidden, array("value" => $id, "hide" => True));
示例10: set_backup_for_host
require_once "modules/backuppc/includes/xmlrpc.php";
require_once "modules/backuppc/includes/functions.php";
require_once "modules/backuppc/includes/html.inc.php";
require_once "modules/base/includes/computers.inc.php";
require "graph/navbar.inc.php";
require "localSidebar.php";
$computer_name = $_GET['cn'];
$uuid = $_GET['objectUUID'];
// ==========================================================
// Receiving request to set backup for host
// ==========================================================
if (isset($_POST['setBackup'], $_POST['host'])) {
$response = set_backup_for_host($_POST['host']);
// Checking reponse
if (isset($response)) {
if (isXMLRPCError() || $response['err']) {
new NotifyWidgetFailure(nl2br($response['errtext']));
} else {
new NotifyWidgetSuccess(sprintf(_T('Computer %s has been added to backup system successfully.<br />You can now configure its filesets and scheduling.', 'backuppc'), $computer_name));
$_GET['tab'] = 'tab2';
}
}
// Setting default profile to nightly
set_host_period_profile($_POST['host'], 1);
$rep = getComputersOS($_POST['host']);
$os = $rep[0]['OSName'];
// Init best profile
$bestProfile = NULL;
$bestSim = 0;
$backup_profiles = get_backup_profiles();
foreach ($backup_profiles as $profile) {
示例11: handleUpload
/**
* Returns array('success'=>true) or array('error'=>'error message')
*/
function handleUpload($uploadDirectory, $random_dir, $p_api_id, $replaceOldFile = FALSE)
{
$uploadDirectory .= '/' . $random_dir . '/';
if (!is_writable($uploadDirectory)) {
return array('error' => "Server error. Upload directory isn't writable.");
}
if (!$this->file) {
return array('error' => 'No files were uploaded.');
}
$size = $this->file->getSize();
if ($size == 0) {
return array('error' => 'File is empty');
}
if ($size > $this->sizeLimit) {
return array('error' => 'File is too large');
}
$pathinfo = pathinfo($this->file->getName());
$filename = $pathinfo['filename'];
//$filename = md5(uniqid());
$ext = @$pathinfo['extension'];
// hide notices if extension is empty
if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) {
$these = implode(', ', $this->allowedExtensions);
return array('error' => 'File has an invalid extension, it should be one of ' . $these . '.');
}
$ext = $ext == '' ? $ext : '.' . $ext;
if (!$replaceOldFile) {
/// don't overwrite previous files that were uploaded
while (file_exists($uploadDirectory . $filename . $ext)) {
$filename .= rand(10, 99);
}
}
$this->uploadName = $filename . $ext;
if ($this->file->save($uploadDirectory . $filename . $ext)) {
// If file pushed to temp directory, push it to MMC agent
$filename = $filename . $ext;
$upload_tmp_dir = sys_get_temp_dir();
$files = array();
// If mmc-agent is not on the same machine than apache server
// send binary files with XMLRPC (base64 encoded)
// else mmc-agent will directly get it from tmp directory
$mmc_ip = xmlrpc_getMMCIP();
$local_mmc = in_array($mmc_ip, array('127.0.0.1', 'localhost', $_SERVER['SERVER_ADDR'])) ? True : False;
$filebinary = False;
if (!$local_mmc) {
$file = $upload_tmp_dir . '/' . $random_dir . '/' . $filename;
// Read and put content of $file to $filebinary
$filebinary = fread(fopen($file, "r"), filesize($file));
}
$files[] = array("filename" => $filename, "filebinary" => $local_mmc ? False : base64_encode($filebinary), "tmp_dir" => $local_mmc ? $upload_tmp_dir : False);
$push_package_result = pushPackage($p_api_id, $random_dir, $files, $local_mmc);
// Delete package from PHP /tmp dir
delete_directory($upload_tmp_dir . '/' . $random_dir);
if (!isXMLRPCError() and $push_package_result) {
return array('success' => true);
} else {
return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered');
}
} else {
return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered');
}
}
示例12: stripslashes
if (isset($_POST["badd"])) {
$groupname = $_POST["groupname"];
$groupdesc = stripslashes($_POST["groupdesc"]);
$result = create_group($error, $groupname);
change_group_desc($groupname, $groupdesc);
if (!isXMLRPCError()) {
new NotifyWidgetSuccess(sprintf(_("Group %s successfully added"), $groupname));
header("Location: " . urlStrRedirect("base/groups/index"));
exit;
}
} else if (isset($_POST["bmodify"])) {
$groupname = $_POST["groupname"];
$groupdesc = stripslashes($_POST["groupdesc"]);
change_group_desc($groupname, $groupdesc);
callPluginFunction("changeGroup", array($_POST));
if (!isXMLRPCError()) new NotifyWidgetSuccess(sprintf(_("Group %s successfully modified"), $groupname));
}
if ($_GET["action"] == "add") {
$title = _("Add group");
$groupname = "";
$groupdesc = "";
$detailArr = array();
} else {
$title = _("Edit group");
$groupname = $_GET["group"];
$detailArr = get_detailed_group($groupname);
if (isset($detailArr["description"])) $groupdesc = htmlspecialchars($detailArr["description"][0]);
else $groupdesc = "";
}
示例13: urldecode
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MMC; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require "modules/samba4/includes/machines-xmlrpc.inc.php";
if (isset($_GET["machine"])) {
$machine = urldecode($_GET["machine"]);
}
if (isset($_POST["machine"])) {
$machine = $_POST["machine"];
}
if (isset($_POST["bdeleletemachine"])) {
$deleteActionSuccess = deleteMachine($machine);
if (!isXMLRPCError() and $deleteActionSuccess) {
$computerDeletedMessage = sprintf(_T("Computer <strong>%s</strong> deleted.", "samba4"), $machine);
new NotifyWidgetSuccess($computerDeletedMessage);
} else {
$computerDeletedMessage = sprintf(_T("There has been a problem while deleting <strong>%s</strong> computer.", "samba4"), $machine);
new NotifyWidgetFailure($computerDeletedMessage);
}
header("location: " . urlStrRedirect('samba4/machines/index'));
exit;
} else {
$form = new PopupForm(_T("Delete a computer", "samba4"));
$form->addText(sprintf(_T("You will delete the %s computer", "samba4"), "<strong>{$machine}</strong>"));
$form->addValidateButton("bdeleletemachine");
$form->addCancelButton("bback");
$form->display();
}
示例14: handleUpload
/**
* Returns array('success'=>true) or array('error'=>'error message')
*/
function handleUpload($uploadDirectory, $random_dir, $p_api_id, $replaceOldFile = FALSE)
{
$uploadDirectory .= '/' . $random_dir . '/';
if (!is_writable($uploadDirectory)) {
return array('error' => "Server error. Upload directory isn't writable.");
}
if (!$this->file) {
return array('error' => 'No files were uploaded.');
}
$size = $this->file->getSize();
if ($size == 0) {
return array('error' => 'File is empty');
}
if ($size > $this->sizeLimit) {
return array('error' => 'File is too large');
}
$pathinfo = pathinfo($this->file->getName());
$filename = $pathinfo['filename'];
//$filename = md5(uniqid());
$ext = @$pathinfo['extension'];
// hide notices if extension is empty
if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) {
$these = implode(', ', $this->allowedExtensions);
return array('error' => 'File has an invalid extension, it should be one of ' . $these . '.');
}
$ext = $ext == '' ? $ext : '.' . $ext;
if (!$replaceOldFile) {
/// don't overwrite previous files that were uploaded
while (file_exists($uploadDirectory . $filename . $ext)) {
$filename .= rand(10, 99);
}
}
$this->uploadName = $filename . $ext;
if ($this->file->save($uploadDirectory . $filename . $ext)) {
// If file pushed to temp directory, push it to package server
$filename = $filename . $ext;
$upload_tmp_dir = sys_get_temp_dir();
$files = array();
$file = $upload_tmp_dir . '/' . $random_dir . '/' . $filename;
// Read and put content of $file to $filebinary
$filebinary = fread(fopen($file, "r"), filesize($file));
$files[] = array("filename" => $filename, "filebinary" => base64_encode($filebinary));
$push_package_result = pushPackage($p_api_id, $random_dir, $files);
// Delete package from PHP /tmp dir
delete_directory($upload_tmp_dir . '/' . $random_dir);
if (!isXMLRPCError() and $push_package_result) {
return array('success' => true);
} else {
return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered');
}
} else {
return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered');
}
}
示例15: _displaySuccessMessage
function _displaySuccessMessage($success, $message)
{
if (!isXMLRPCError() and $success) {
new NotifyWidgetSuccess($message);
} else {
global $errorStatus;
$errorStatus = 0;
}
}