当前位置: 首页>>代码示例>>PHP>>正文


PHP addLogEntry函数代码示例

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


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

示例1: handle_ajax_call

 public function handle_ajax_call()
 {
     global $INPUT;
     header('Content-Type: text/plain');
     $langCode = $INPUT->str('lang');
     $text = $INPUT->str('text');
     $dir = DOKU_CONF . 'lang/' . $langCode;
     $file = $dir . '/register.txt';
     // make sure the directory exists
     if (!file_exists($dir)) {
         if (mkdir($dir, 0755) === false) {
             echo $this->getLang('makeDirError');
             return;
         }
     }
     // save the file
     if (file_put_contents($file, $text) === false) {
         echo $this->getLang('saveFileError');
         return;
     }
     // set file permissions
     chmod($file, 0644);
     // log the change
     $timestamp = time();
     $id = $langCode . ':register';
     addLogEntry($timestamp, $id);
     // save this revision in the attic
     $atticFile = wikiFN($id, $timestamp, true);
     io_saveFile($atticFile, $text, false);
     // send OK to the browser
     echo 'OK';
 }
开发者ID:richmahn,项目名称:Door43,代码行数:32,代码来源:RegisterEdit.php

示例2: handle_ajax_call_unknown

 /**
  * @param Doku_Event $event  event object by reference
  * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
  *                           handler was registered]
  * @return void
  */
 public function handle_ajax_call_unknown(Doku_Event &$event, $param)
 {
     if ($event->data !== 'door43_register_edit') {
         return;
     }
     //no other action handlers needed
     $event->stopPropagation();
     $event->preventDefault();
     global $INPUT;
     header('Content-Type: text/plain');
     $langCode = $INPUT->str('lang');
     $text = $INPUT->str('text');
     $dir = DOKU_CONF . 'lang/' . $langCode;
     $file = $dir . '/register.txt';
     // make sure the directory exists
     if (!file_exists($dir)) {
         if (mkdir($dir, 0755) === false) {
             echo $this->getLang('makeDirError');
             return;
         }
     }
     // save the file
     if (file_put_contents($file, $text) === false) {
         echo $this->getLang('saveFileError');
         return;
     }
     // set file permissions
     chmod($file, 0644);
     // log the change
     $timestamp = time();
     $id = $langCode . ':register';
     addLogEntry($timestamp, $id);
     // save this revision in the attic
     $atticFile = wikiFN($id, $timestamp, true);
     io_saveFile($atticFile, $text, false);
     // send OK to the browser
     echo 'OK';
 }
开发者ID:neutrinog,项目名称:Door43,代码行数:44,代码来源:RegisterEdit.php

示例3: handleHiddenFlags

/**
 * Handles features defined in config.inc.php
 *
 * @since 1.2
 * @package facileManager
 */
function handleHiddenFlags()
{
    global $fm_name;
    /** Recover authentication in case of lockout */
    if (defined('FM_NO_AUTH') && FM_NO_AUTH) {
        setOption('auth_method', 0);
        @addLogEntry(_('Manually reset authentication method.'), $fm_name);
    }
}
开发者ID:Vringe,项目名称:facileManager,代码行数:15,代码来源:functions.php

示例4: saveWikiText

/**
 * Saves a wikitext by calling io_writeWikiPage.
 * Also directs changelog and attic updates.
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Ben Coburn <btcoburn@silicodon.net>
 */
function saveWikiText($id, $text, $summary, $minor = false)
{
    /* Note to developers:
         This code is subtle and delicate. Test the behavior of
         the attic and changelog with dokuwiki and external edits
         after any changes. External edits change the wiki page
         directly without using php or dokuwiki.
      */
    global $conf;
    global $lang;
    global $REV;
    // ignore if no changes were made
    if ($text == rawWiki($id, '')) {
        return;
    }
    $file = wikiFN($id);
    $old = @filemtime($file);
    // from page
    $wasRemoved = empty($text);
    $wasCreated = !@file_exists($file);
    $wasReverted = $REV == true;
    $newRev = false;
    $oldRev = getRevisions($id, -1, 1, 1024);
    // from changelog
    $oldRev = (int) (empty($oldRev) ? 0 : $oldRev[0]);
    if (!@file_exists(wikiFN($id, $old)) && @file_exists($file) && $old >= $oldRev) {
        // add old revision to the attic if missing
        saveOldRevision($id);
        // add a changelog entry if this edit came from outside dokuwiki
        if ($old > $oldRev) {
            addLogEntry($old, $id);
            // send notify mails
            notify($id, 'admin', $oldRev, '', false);
            notify($id, 'subscribers', $oldRev, '', false);
            // remove soon to be stale instructions
            $cache = new cache_instructions($id, $file);
            $cache->removeCache();
        }
    }
    if ($wasRemoved) {
        // pre-save deleted revision
        @touch($file);
        clearstatcache();
        $newRev = saveOldRevision($id);
        // remove empty file
        @unlink($file);
        // remove old meta info...
        $mfiles = metaFiles($id);
        $changelog = metaFN($id, '.changes');
        foreach ($mfiles as $mfile) {
            // but keep per-page changelog to preserve page history
            if (@file_exists($mfile) && $mfile !== $changelog) {
                @unlink($mfile);
            }
        }
        $del = true;
        // autoset summary on deletion
        if (empty($summary)) {
            $summary = $lang['deleted'];
        }
        // remove empty namespaces
        io_sweepNS($id, 'datadir');
        io_sweepNS($id, 'mediadir');
    } else {
        // save file (namespace dir is created in io_writeWikiPage)
        io_writeWikiPage($file, $text, $id);
        // pre-save the revision, to keep the attic in sync
        $newRev = saveOldRevision($id);
        $del = false;
    }
    // select changelog line type
    $extra = '';
    $type = 'E';
    if ($wasReverted) {
        $type = 'R';
        $extra = $REV;
    } else {
        if ($wasCreated) {
            $type = 'C';
        } else {
            if ($wasRemoved) {
                $type = 'D';
            } else {
                if ($minor && $conf['useacl'] && $_SERVER['REMOTE_USER']) {
                    $type = 'e';
                }
            }
        }
    }
    //minor edits only for logged in users
    addLogEntry($newRev, $id, $type, $summary, $extra);
    // send notify mails
    notify($id, 'admin', $old, $summary, $minor);
//.........这里部分代码省略.........
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:101,代码来源:common.php

示例5: saveWikiText


//.........这里部分代码省略.........
         after any changes. External edits change the wiki page
         directly without using php or dokuwiki.
       */
    global $conf;
    global $lang;
    global $REV;
    /* @var Input $INPUT */
    global $INPUT;
    // prepare data for event
    $svdta = array();
    $svdta['id'] = $id;
    $svdta['file'] = wikiFN($id);
    $svdta['revertFrom'] = $REV;
    $svdta['oldRevision'] = @filemtime($svdta['file']);
    $svdta['newRevision'] = 0;
    $svdta['newContent'] = $text;
    $svdta['oldContent'] = rawWiki($id);
    $svdta['summary'] = $summary;
    $svdta['contentChanged'] = $svdta['newContent'] != $svdta['oldContent'];
    $svdta['changeInfo'] = '';
    $svdta['changeType'] = DOKU_CHANGE_TYPE_EDIT;
    $svdta['sizechange'] = null;
    // select changelog line type
    if ($REV) {
        $svdta['changeType'] = DOKU_CHANGE_TYPE_REVERT;
        $svdta['changeInfo'] = $REV;
    } else {
        if (!file_exists($svdta['file'])) {
            $svdta['changeType'] = DOKU_CHANGE_TYPE_CREATE;
        } else {
            if (trim($text) == '') {
                // empty or whitespace only content deletes
                $svdta['changeType'] = DOKU_CHANGE_TYPE_DELETE;
                // autoset summary on deletion
                if (blank($svdta['summary'])) {
                    $svdta['summary'] = $lang['deleted'];
                }
            } else {
                if ($minor && $conf['useacl'] && $INPUT->server->str('REMOTE_USER')) {
                    //minor edits only for logged in users
                    $svdta['changeType'] = DOKU_CHANGE_TYPE_MINOR_EDIT;
                }
            }
        }
    }
    $event = new Doku_Event('COMMON_WIKIPAGE_SAVE', $svdta);
    if (!$event->advise_before()) {
        return;
    }
    // if the content has not been changed, no save happens (plugins may override this)
    if (!$svdta['contentChanged']) {
        return;
    }
    detectExternalEdit($id);
    if ($svdta['changeType'] == DOKU_CHANGE_TYPE_CREATE || $svdta['changeType'] == DOKU_CHANGE_TYPE_REVERT && !file_exists($svdta['file'])) {
        $filesize_old = 0;
    } else {
        $filesize_old = filesize($svdta['file']);
    }
    if ($svdta['changeType'] == DOKU_CHANGE_TYPE_DELETE) {
        // Send "update" event with empty data, so plugins can react to page deletion
        $data = array(array($svdta['file'], '', false), getNS($id), noNS($id), false);
        trigger_event('IO_WIKIPAGE_WRITE', $data);
        // pre-save deleted revision
        @touch($svdta['file']);
        clearstatcache();
        $data['newRevision'] = saveOldRevision($id);
        // remove empty file
        @unlink($svdta['file']);
        $filesize_new = 0;
        // don't remove old meta info as it should be saved, plugins can use IO_WIKIPAGE_WRITE for removing their metadata...
        // purge non-persistant meta data
        p_purge_metadata($id);
        // remove empty namespaces
        io_sweepNS($id, 'datadir');
        io_sweepNS($id, 'mediadir');
    } else {
        // save file (namespace dir is created in io_writeWikiPage)
        io_writeWikiPage($svdta['file'], $svdta['newContent'], $id);
        // pre-save the revision, to keep the attic in sync
        $svdta['newRevision'] = saveOldRevision($id);
        $filesize_new = filesize($svdta['file']);
    }
    $svdta['sizechange'] = $filesize_new - $filesize_old;
    $event->advise_after();
    addLogEntry($svdta['newRevision'], $svdta['id'], $svdta['changeType'], $svdta['summary'], $svdta['changeInfo'], null, $svdta['sizechange']);
    // send notify mails
    notify($svdta['id'], 'admin', $svdta['oldRevision'], $svdta['summary'], $minor);
    notify($svdta['id'], 'subscribers', $svdta['oldRevision'], $svdta['summary'], $minor);
    // update the purgefile (timestamp of the last time anything within the wiki was changed)
    io_saveFile($conf['cachedir'] . '/purgefile', time());
    // if useheading is enabled, purge the cache of all linking pages
    if (useHeading('content')) {
        $pages = ft_backlinks($id, true);
        foreach ($pages as $page) {
            $cache = new cache_renderer($page, wikiFN($page), 'xhtml');
            $cache->removeCache();
        }
    }
}
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:101,代码来源:common.php

示例6: backupDatabase

 /**
  * Backs up the database
  *
  * @since 1.0
  * @package facileManager
  */
 function backupDatabase()
 {
     global $__FM_CONFIG, $fm_name;
     if (!currentUserCan('run_tools')) {
         return sprintf('<p class="error">%s</p>', _('You are not authorized to run these tools.'));
     }
     /** Temporary fix for MySQL 5.6 warnings */
     $exclude_warnings = array('Warning: Using a password on the command line interface can be insecure.' . "\n");
     $curdate = date("Y-m-d_H.i.s");
     $sql_file = sys_get_temp_dir() . '/' . $__FM_CONFIG['db']['name'] . '_' . $curdate . '.sql';
     $error_log = str_replace('.sql', '.err', $sql_file);
     $mysqldump = findProgram('mysqldump');
     if (!$mysqldump) {
         return sprintf('<p class="error">' . _('mysqldump is not found on %s.') . '</p>', php_uname('n'));
     }
     $command_string = "{$mysqldump} --opt -Q -h {$__FM_CONFIG['db']['host']} -u {$__FM_CONFIG['db']['user']} -p{$__FM_CONFIG['db']['pass']} {$__FM_CONFIG['db']['name']} > " . sys_get_temp_dir() . "/{$__FM_CONFIG['db']['name']}_{$curdate}.sql 2>{$error_log}";
     @system($command_string, $retval);
     $retarr = @file_get_contents($error_log);
     if ($retval) {
         @unlink($error_log);
         @unlink($sql_file);
         return '<p class="error">' . nl2br(str_replace($exclude_warnings, '', $retarr)) . '</p>';
     }
     compressFile($sql_file, @file_get_contents($sql_file));
     @unlink($error_log);
     @unlink($sql_file);
     addLogEntry(_('Backed up the database.'), $fm_name);
     sendFileToBrowser($sql_file . '.gz');
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:35,代码来源:class_tools.php

示例7: test_editor_and_externaledits

 /**
  *  test editor entry and external edit
  */
 function test_editor_and_externaledits()
 {
     global $ID, $conf;
     $ID = 'wiki:syntax';
     $filename = $conf['datadir'] . '/wiki/syntax.txt';
     $rev = filemtime($filename);
     $info = $this->_get_expected_pageinfo();
     $info['id'] = 'wiki:syntax';
     $info['namespace'] = 'wiki';
     $info['filepath'] = $filename;
     $info['exists'] = true;
     $info['lastmod'] = $rev;
     $info['currentrev'] = $rev;
     $info['meta'] = p_get_metadata($ID);
     // need $INFO set correctly for addLogEntry()
     global $INFO;
     $INFO = $info;
     // add an editor for the current version of $ID
     addLogEntry($rev, $ID);
     $info['meta'] = p_get_metadata($ID);
     $info['editor'] = $_SERVER['REMOTE_USER'];
     $info['user'] = $_SERVER['REMOTE_USER'];
     $info['ip'] = $_SERVER['REMOTE_ADDR'];
     $info['sum'] = '';
     // with an editor ...
     $this->assertEquals($info, pageinfo());
     // clear the meta['last_change'] value, pageinfo should restore it
     p_set_metadata($ID, array('last_change' => false));
     $this->assertEquals($info, pageinfo());
     $this->assertEquals($info['meta']['last_change'], p_get_metadata($ID, 'last_change'));
     // fake an external edit, pageinfo should clear the last change from meta data
     // and not return any editor data
     $now = time() + 10;
     touch($filename, $now);
     $info['lastmod'] = $now;
     $info['currentrev'] = $now;
     $info['meta']['last_change'] = false;
     $info['ip'] = null;
     $info['user'] = null;
     $info['sum'] = null;
     $info['editor'] = null;
     $this->assertEquals($info, pageinfo());
     $this->assertEquals($info['meta'], p_get_metadata($ID));
     // check metadata has been updated correctly
 }
开发者ID:richmahn,项目名称:Door43,代码行数:48,代码来源:common_pageinfo.test.php

示例8: switch

    include ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $fm_name . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'class_users.php';
    switch ($_POST['action']) {
        case 'delete':
            if (isset($id)) {
                $delete_status = $fm_users->delete(sanitize($id), substr(sanitize($_POST['item_sub_type']), 0, -1));
                if ($delete_status !== true) {
                    echo $delete_status;
                } else {
                    exit('Success');
                }
            }
            break;
        case 'edit':
            if (isset($_POST['item_status'])) {
                if (!updateStatus('fm_users', $id, 'user_', sanitize($_POST['item_status']), 'user_id')) {
                    exit(sprintf(_('This user could not be set to %s.') . "\n", $_POST['item_status']));
                } else {
                    $tmp_name = getNameFromID($id, 'fm_users', 'user_', 'user_id', 'user_login');
                    addLogEntry(sprintf(_('Set user (%s) status to %s.'), $tmp_name, sanitize($_POST['item_status'])));
                    exit('Success');
                }
            }
            break;
    }
    /** Handle everything else */
} elseif (isset($_SESSION['module']) && $_SESSION['module'] != $fm_name) {
    $include_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $_SESSION['module'] . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'processPost.php';
    if (file_exists($include_file)) {
        include $include_file;
    }
}
开发者ID:Vringe,项目名称:facileManager,代码行数:31,代码来源:processPost.php

示例9: delete

 /**
  * Deletes the selected logging channel/category
  */
 function delete($id, $server_serial_no = 0, $type)
 {
     global $fmdb, $__FM_CONFIG;
     /** Check if channel is currently associated with category */
     if ($type == 'channel' && is_array($this->getAssocCategories($id))) {
         return sprintf(__('This %s could not be deleted because it is associated with one or more categories.'), $type);
     }
     $tmp_name = getNameFromID($id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', 'cfg_', 'cfg_id', 'cfg_data');
     /** Delete associated children */
     $query = "UPDATE `fm_{$__FM_CONFIG['fmDNS']['prefix']}config` SET `cfg_status`='deleted' WHERE `cfg_parent`={$id}";
     $fmdb->query($query);
     /** Delete item */
     if (updateStatus('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', $id, 'cfg_', 'deleted', 'cfg_id') === false) {
         return sprintf(__('This %s could not be deleted because a database error occurred.'), $type);
     } else {
         setBuildUpdateConfigFlag($server_serial_no, 'yes', 'build');
         addLogEntry(sprintf(__("Logging %s '%s' was deleted."), $type, $tmp_name));
         return true;
     }
 }
开发者ID:Vringe,项目名称:facileManager,代码行数:23,代码来源:class_logging.php

示例10: processReloadFailure

/**
 * Logs and outputs error messages
 *
 * @since 2.0
 * @package facileManager
 * @subpackage fmDNS
 *
 * @param string $last_line Output from previously run command
 * @return boolean
 */
function processReloadFailure($last_line)
{
    if ($debug) {
        echo fM($last_line);
    }
    addLogEntry($last_line);
    $message = "There was an error reloading the server - please check the logs for details\n";
    if ($debug) {
        echo fM($message);
    }
    addLogEntry($message);
    return false;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:23,代码来源:functions.php

示例11: addRequest

function addRequest($forimaging = 0, $revisionid = array(), $checkuser = 1)
{
    global $requestInfo, $user, $uniqid, $mysql_link_vcl;
    $startstamp = unixToDatetime($requestInfo["start"]);
    $endstamp = unixToDatetime($requestInfo["end"]);
    $now = time();
    if ($requestInfo["start"] <= $now) {
        $start = unixToDatetime($now);
        $nowfuture = "now";
    } else {
        $start = $startstamp;
        $nowfuture = "future";
    }
    addLogEntry($nowfuture, $start, $endstamp, 1, $requestInfo["imageid"]);
    $qh = doQuery("SELECT LAST_INSERT_ID() FROM log", 131);
    if (!($row = mysql_fetch_row($qh))) {
        abort(132);
    }
    $logid = $row[0];
    # add single entry to request table
    $query = "INSERT INTO request " . "(stateid, " . "userid, " . "laststateid, " . "logid, " . "forimaging, " . "start, " . "end, " . "daterequested, " . "checkuser) " . "VALUES " . "(13, " . "{$user['id']}, " . "13, " . "{$logid}, " . "{$forimaging}, " . "'{$startstamp}', " . "'{$endstamp}', " . "NOW(), " . "{$checkuser})";
    $qh = doQuery($query, 136);
    $qh = doQuery("SELECT LAST_INSERT_ID() FROM request", 134);
    if (!($row = mysql_fetch_row($qh))) {
        abort(135);
    }
    $requestid = $row[0];
    # add requestid to log entry
    $query = "UPDATE log " . "SET requestid = {$requestid} " . "WHERE id = {$logid}";
    doQuery($query, 101);
    # add an entry to the reservation table for each image
    # NOTE: make sure parent image is the first entry we add
    #   so that it has the lowest reservationid
    foreach ($requestInfo["images"] as $key => $imageid) {
        if (array_key_exists($imageid, $revisionid) && !empty($revisionid[$imageid])) {
            $imagerevisionid = array_shift($revisionid[$imageid]);
        } else {
            $imagerevisionid = getProductionRevisionid($imageid);
        }
        $computerid = $requestInfo["computers"][$key];
        $mgmtnodeid = $requestInfo['mgmtnodes'][$key];
        $fromblock = $requestInfo['fromblock'][$key];
        if ($fromblock) {
            $blockdata = $requestInfo['blockdata'][$key];
        } else {
            $blockdata = array();
        }
        addSublogEntry($logid, $imageid, $imagerevisionid, $computerid, $mgmtnodeid, $fromblock, $blockdata);
    }
    $query = "INSERT INTO reservation " . "(requestid, " . "computerid, " . "imageid, " . "imagerevisionid, " . "managementnodeid) " . "SELECT {$requestid}, " . "computerid, " . "imageid, " . "imagerevisionid, " . "managementnodeid " . "FROM semaphore " . "WHERE expires > NOW() AND " . "procid = '{$uniqid}'";
    doQuery($query);
    $cnt = mysql_affected_rows($mysql_link_vcl);
    if ($cnt == 0) {
        # reached this point SEMTIMEOUT seconds after getting semaphore, clean up and abort
        $query = "DELETE FROM request WHERE id = {$requestid}";
        doQuery($query);
        $query = "UPDATE log SET wasavailable = 0 WHERE id = {$logid}";
        doQuery($query);
        $query = "DELETE FROM sublog WHERE logid = {$logid}";
        doQuery($query);
        abort(400);
    } else {
        $query = "INSERT INTO changelog " . "(logid, " . "start, " . "end, " . "timestamp) " . "VALUES " . "({$logid}, " . "'{$start}', " . "'{$endstamp}', " . "NOW())";
        doQuery($query, 136);
    }
    // release semaphore lock
    cleanSemaphore();
    return $requestid;
}
开发者ID:bq-xiao,项目名称:apache-vcl,代码行数:69,代码来源:utils.php

示例12: upgradeConfig

/**
 * Updates the database with the db version number.
 *
 * @since 1.0
 * @package facileManager
 * @subpackage Upgrader
 */
function upgradeConfig($field, $value, $logit = true)
{
    global $fmdb;
    $query = "UPDATE `fm_options` SET option_value='{$value}' WHERE option_name='{$field}'";
    $fmdb->query($query);
    if ($fmdb->last_error) {
        echo $fmdb->last_error;
        return false;
    }
    session_id($_COOKIE['myid']);
    @session_start();
    unset($_SESSION['user']['fm_perms']);
    if ($logit) {
        include ABSPATH . 'fm-includes/version.php';
        include ABSPATH . 'fm-modules/facileManager/variables.inc.php';
        addLogEntry(sprintf(_('%s was upgraded to %s.'), $fm_name, $fm_version), $fm_name);
    }
    return true;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:26,代码来源:upgrade.php

示例13: deleteFile

/**
 * Deletes specified file and directory contents
 *
 * @since 2.0.1
 * @package facileManager
 *
 * @param string $file Filename to delete
 * @param boolean $debug Debug mode or not
 * @param boolean $dryrun Whether it's a dry-run or not
 * @return boolean
 */
function deleteFile($file, $debug = false, $dryrun = false)
{
    if (is_dir($file)) {
        if ($file == '/') {
            return false;
        }
        foreach (scandir($file) as $item) {
            if (in_array($item, array('.', '..'))) {
                continue;
            }
            $full_path_file = $file . DIRECTORY_SEPARATOR . $item;
            deleteFile($full_path_file, $debug, $dryrun);
        }
    } else {
        $message = "Deleting {$file}.\n";
        if ($debug) {
            echo fM($message);
        }
        if (!$dryrun) {
            addLogEntry($message);
            unlink($file);
        }
    }
    return true;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:36,代码来源:functions.php

示例14: delete

 /**
  * Deletes the selected user
  *
  * @since 1.0
  * @package facileManager
  */
 function delete($id)
 {
     global $fm_name;
     /** Ensure user is not current LDAP template user */
     if (getOption('auth_method') == 2) {
         $template_user_id = getOption('ldap_user_template');
         if ($id == $template_user_id) {
             return _('This user is the LDAP user template and cannot be deleted at this time.');
         }
     }
     $tmp_name = getNameFromID($id, 'fm_users', 'user_', 'user_id', 'user_login');
     if (!updateStatus('fm_users', $id, 'user_', 'deleted', 'user_id')) {
         return _('This user could not be deleted.') . "\n";
     } else {
         addLogEntry(sprintf(_("Deleted user '%s'."), $tmp_name), $fm_name);
         return true;
     }
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:24,代码来源:class_users.php

示例15: buildConf

function buildConf($url, $data)
{
    global $proto, $debug;
    if ($data['dryrun'] && $debug) {
        echo fM("Dryrun mode (nothing will be written to disk)\n\n");
    }
    $raw_data = getPostData($url, $data);
    $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data);
    if (!is_array($raw_data)) {
        if ($debug) {
            echo fM($raw_data);
        }
        addLogEntry($raw_data);
        exit(1);
    }
    if ($debug) {
        foreach ($raw_data['files'] as $filename => $contents) {
            echo str_repeat('=', 50) . "\n";
            echo $filename . ":\n";
            echo str_repeat('=', 50) . "\n";
            echo $contents . "\n\n";
        }
    }
    extract($raw_data, EXTR_SKIP);
    $runas = 'root';
    $chown_files = array($server_root_dir);
    /** Install the new files */
    installFiles($runas, $chown_files, $files, $data['dryrun']);
    $message = "Reloading the server\n";
    if ($debug) {
        echo fM($message);
    }
    $rc_script = str_replace('__FILE__', $server_config_file, getStartupScript($server_type));
    $message = "{$rc_script}\n";
    if ($debug) {
        echo fM($message);
    }
    if (!$data['dryrun']) {
        addLogEntry($message);
        $rc_script = str_replace('__FILE__', $server_config_file, getStartupScript($server_type));
        if ($rc_script === false) {
            $last_line = "Cannot locate the start script\n";
            if ($debug) {
                echo fM($last_line);
            }
            addLogEntry($last_line);
            $retval = true;
        } else {
            $last_line = system($rc_script . ' 2>&1', $retval);
            addLogEntry($last_line);
        }
        if ($retval) {
            $message = "There was an error reloading the firewall - please check the logs for details\n";
            if ($debug) {
                echo fM($message);
            }
            addLogEntry($message);
            return false;
        } else {
            /** Update the server with a successful reload */
            $data['action'] = 'update';
            $raw_update = getPostData($url, $data);
            $raw_update = $data['compress'] ? @unserialize(gzuncompress($raw_update)) : @unserialize($raw_update);
        }
    }
    return true;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:67,代码来源:functions.php


注:本文中的addLogEntry函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。