• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isXMLRPCError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中isXMLRPCError函数的典型用法代码示例。如果您正苦于以下问题:PHP isXMLRPCError函数的具体用法?PHP isXMLRPCError怎么用?PHP isXMLRPCError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isXMLRPCError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: resetDefaultMenu

function resetDefaultMenu($uuid)
{
    $ret = xmlrpc_resetComputerBootMenu($uuid);
    if (!isXMLRPCError() && $ret) {
        new NotifyWidgetSuccess(sprintf(_T("Default menu has been successfully restored.", "imaging")));
    }
}
开发者ID:pulse-project,项目名称:pulse,代码行数:7,代码来源:tabs.php


示例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;
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:33,代码来源:users-xmlrpc.inc.php


示例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 />";
    }
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:12,代码来源:servicedhcpfailover.php


示例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'];
开发者ID:neoclust,项目名称:mmc,代码行数:30,代码来源:tabs.php


示例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;
//.........这里部分代码省略.........
开发者ID:pulse-project,项目名称:pulse,代码行数:101,代码来源:launch.php


示例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'];
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:configure.php


示例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);
//.........这里部分代码省略.........
开发者ID:sebastiendu,项目名称:mmc,代码行数:101,代码来源:xmlrpc.inc.php


示例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) {
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:location.php


示例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));
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:activateAppstreamFlow.php


示例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) {
开发者ID:sebastiendu,项目名称:mmc,代码行数:31,代码来源:hostStatus.php


示例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');
     }
 }
开发者ID:sebastiendu,项目名称:mmc,代码行数:65,代码来源:fileuploader.php


示例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 = "";
}
开发者ID:neoclust,项目名称:mmc,代码行数:31,代码来源:edit.php


示例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();
}
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:delete.php


示例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');
     }
 }
开发者ID:neoclust,项目名称:mmc,代码行数:57,代码来源:fileuploader.php


示例15: _displaySuccessMessage

function _displaySuccessMessage($success, $message)
{
    if (!isXMLRPCError() and $success) {
        new NotifyWidgetSuccess($message);
    } else {
        global $errorStatus;
        $errorStatus = 0;
    }
}
开发者ID:psyray,项目名称:mmc,代码行数:9,代码来源:edit.php


示例16: _samba_changeUser

/**
 * Function called for changing user attributes
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _samba_changeUser($FH, $mode)
{
    global $error;
    global $result;
    # check users profiles setup
    $globalProfiles = xmlCall("samba.isProfiles");
    # Already existing SAMBA user
    if (hasSmbAttr($FH->getPostValue("uid"))) {
        # Remove atrributes
        if (!$FH->getPostValue("isSamba")) {
            rmSmbAttr($FH->getPostValue("uid"));
            $result .= _T("Samba attributes deleted.", "samba") . "<br />";
        } else {
            # Remove passwords from the $_POST array coming from the add/edit user page
            # because we don't want to send them again via RPC.
            $FH->delPostValue("pass");
            $FH->delPostValue("confpass");
            // Format samba attributes
            if ($FH->isUpdated("sambaPwdMustChange")) {
                if ($FH->getValue("sambaPwdMustChange") == "on") {
                    // force user to change password
                    $FH->setValue("sambaPwdMustChange", "0");
                    $FH->setValue("sambaPwdLastSet", "0");
                } else {
                    $FH->setValue("sambaPwdMustChange", "");
                    $FH->setValue("sambaPwdLastSet", (string) time());
                }
            }
            // account expiration
            if ($FH->isUpdated("sambaKickoffTime")) {
                $datetime = $FH->getValue("sambaKickoffTime");
                // 2010-09-23 18:32:00
                if (strlen($datetime) == 19) {
                    $timestamp = mktime(substr($datetime, -8, 2), substr($datetime, -5, 2), substr($datetime, -2, 2), substr($datetime, 5, 2), substr($datetime, 8, 2), substr($datetime, 0, 4));
                    $FH->setValue("sambaKickoffTime", "{$timestamp}");
                } else {
                    $FH->setValue("sambaKickoffTime", "");
                }
            }
            // Network profile path
            if ($FH->isUpdated("sambaProfilePath") && !$globalProfiles) {
                $FH->setValue("sambaProfilePath", $FH->getPostValue("sambaProfilePath"));
            }
            if (!$FH->getPostValue("hasProfile") && $FH->getPostValue("old_hasProfile") == "on") {
                $FH->setValue("sambaProfilePath", "");
            }
            // change attributes
            changeSmbAttr($FH->getPostValue("uid"), $FH->getValues());
            if (isEnabledUser($FH->getPostValue("uid"))) {
                if ($FH->getPostValue('isSmbDesactive')) {
                    smbDisableUser($FH->getPostValue("uid"));
                    $result .= _T("Samba account disabled.", "samba") . "<br />";
                }
            } else {
                if (!$FH->getPostValue('isSmbDesactive')) {
                    smbEnableUser($FH->getPostValue("uid"));
                    $result .= _T("Samba account enabled.", "samba") . "<br />";
                }
            }
            if (isLockedUser($FH->getPostValue("uid"))) {
                if (!$FH->getPostValue('isSmbLocked')) {
                    smbUnlockUser($FH->getPostValue("uid"));
                }
            } else {
                if ($FH->getPostValue('isSmbLocked')) {
                    smbLockUser($FH->getPostValue("uid"));
                }
            }
        }
    } else {
        //if not have smb attributes
        if ($FH->getPostValue("isSamba")) {
            # Add SAMBA attributes
            addSmbAttr($FH->getPostValue("uid"), $FH->getPostValue("pass"));
            if (!isXMLRPCError()) {
                // Format samba attributes
                if ($FH->getPostValue("sambaPwdMustChange") == "on") {
                    $FH->setPostValue("sambaPwdMustChange", "0");
                    $FH->setPostValue("sambaPwdLastSet", "0");
                } else {
                    $FH->setPostValue("sambaPwdMustChange", "");
                }
                // Account expiration
                if ($FH->isUpdated("sambaKickoffTime")) {
                    $datetime = $FH->getValue("sambaKickoffTime");
                    // 2010-09-23 18:32:00
                    if (strlen($datetime) == 19) {
                        $timestamp = mktime(substr($datetime, -8, 2), substr($datetime, -5, 2), substr($datetime, -2, 2), substr($datetime, 5, 2), substr($datetime, 8, 2), substr($datetime, 0, 4));
                        $FH->setPostValue("sambaKickoffTime", "{$timestamp}");
                    } else {
                        $FH->setPostValue("sambaKickoffTime", "");
                    }
                }
                // Network profile
                // Clear profile path if global profiles are on
//.........这里部分代码省略.........
开发者ID:pulse-project,项目名称:pulse,代码行数:101,代码来源:publicFunc.php


示例17: create_group

function create_group(&$error, $group)
{
    if ($group == "") {
        $error = "Groupe nul";
        return;
    }
    if (in_array($group, get_groups($error))) {
        $error = sprintf(_("Group %s already exist"), $group);
        return;
    }
    $ret = xmlCall("base.createGroup", $group);
    if (in_array("samba", $_SESSION["supportModList"])) {
        // FIXME: should be a choice made by the user
        // Samba plugin is enabled, so we make this group a Samba group,
        // but only if we are a PDC.
        $pdc = xmlCall("samba.isPdc", null);
        if ($pdc) {
            xmlCall("samba.makeSambaGroup", array($group));
        }
    }
    if (!isXMLRPCError()) {
        return sprintf(_("Group %s created"), $group);
    } else {
        return;
    }
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:26,代码来源:groups-xmlrpc.inc.php


示例18: header

            header("Location: " . urlStrRedirect("mail/domains/index"));
            exit;
        }
    } else {
        if (isset($_POST["bedit"]) || isset($_POST["breset"])) {
            setVDomainDescription($domainname, $description);
            if (strlen($domainquota)) {
                setVDomainQuota($domainname, $domainquota);
            }
            $result = _T("The mail domain has been modified.", "mail") . "<br />";
            if (isset($_POST["breset"])) {
                resetUsersVDomainQuota($domainname);
                $result .= _T(" The quota of all users of this mail domain have been reset.") . "<br />";
            }
            // Display result message
            if ($result && !isXMLRPCError()) {
                new NotifyWidgetSuccess($result);
            }
        }
    }
}
$p = new PageGenerator($title);
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
if ($mode == "add") {
    $domainTpl = new DomainInputTpl("domainname");
} else {
    $domainTpl = new HiddenTpl("domainname");
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:31,代码来源:edit.php


示例19: array

     $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));
     }
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:add.php


示例20: sys_get_temp_dir

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_404函数代码示例发布时间:2022-05-15
下一篇:
PHP isWindows函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap