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


PHP lfile_put_contents函数代码示例

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


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

示例1: os_fix_fstab

function os_fix_fstab()
{
    $list = lfile_trim("/etc/fstab");
    foreach ($list as $l) {
        $nl = trimSpaces($l);
        $n = explode(" ", $nl);
        if ($n[1] !== "/home" && $n[1] !== '/') {
            $out[] = $l;
            continue;
        }
        if (!csa($n[3], "usrquota")) {
            $mount[] = $n[1];
            $n[3] = "{$n['3']},usrquota,grpquota";
        }
        $o = implode("\t", $n);
        $out[] = $o;
    }
    $out = implode("\n", $out);
    $out .= "\n";
    dprint($out);
    lfile_put_contents("/etc/fstab", $out);
    dprintr($mount);
    foreach ($mount as $m) {
        system("mount {$m} -o remount");
    }
}
开发者ID:zseand,项目名称:kloxo,代码行数:26,代码来源:linuxlib.php

示例2: convertfile

 static function convertfile($oldtime, $newtime)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $file = '/var/log/kloxo/maillog';
     if (!lxfile_real($file)) {
         return null;
     }
     $fp = fopen($file, "r");
     $fsize = filesize($file);
     $ret = FindRightPosition($fp, $fsize, $oldtime, $newtime, array("mailtraffic", "getTimeFromOriginalQmailString"));
     if ($ret < 0) {
         dprint("Could not find position\n");
         return;
     }
     $totstring = null;
     $count = 0;
     while (!feof($fp)) {
         $count++;
         if ($count > 1000000) {
             break;
         }
         $string = fgets($fp);
         $totstring .= $string;
         if (self::getTimeFromOriginalQmailString($string) > $newtime) {
             break;
         }
     }
     fclose($fp);
     $convertfile = tempnam("/tmp/", "mail_log");
     $convertfile_source = tempnam("/tmp/", "mail_log_source");
     lfile_put_contents($convertfile_source, $totstring);
     system("perl {$sgbl->__path_kloxo_httpd_root}/awstats/tools/maillogconvert.pl standard < {$convertfile_source} > {$convertfile}");
     lunlink($convertfile_source);
     return $convertfile;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:35,代码来源:mailtrafficlib.php

示例3: createDnsData

 function createDnsData()
 {
     dprint("DbActionAdd\n");
     $fdata = "";
     $tmp = "";
     $this->createPrimaryZone($this->main->nname);
     lfile_put_contents("c:/Windows/System32/drivers/etc/hosts", "127.0.0.1 {$this->main->nname}", FILE_APPEND);
     return null;
 }
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:9,代码来源:dns__msdnslib.php

示例4: createMimeType

 function createMimeType()
 {
     $result = $this->main->__var_mime_list;
     $result = merge_array_object_not_deleted($result, $this->main);
     $string = null;
     foreach ($result as $r) {
         $string .= "Addtype {$r['type']} {$r['extension']}\n";
     }
     lfile_put_contents("/etc/httpd/conf/kloxo/mimetype.conf", $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:10,代码来源:mimetype__apachelib.php

示例5: moveToTrash

 static function moveToTrash($user, $root, $name)
 {
     $trashcont = "{$root}/.trash/.__trash_" . basename($name);
     $fullpath = "{$root}/{$name}";
     lxfile_rm_rec("{$root}/.trash/" . basename($name));
     lxfile_rm_rec($trashcont);
     $res = lxuser_mkdir($user, "{$root}/.trash/");
     lfile_put_contents($trashcont, $name . "\n");
     $res = new_process_mv_rec($user, $fullpath, "{$root}/.trash");
     //unlink($f);
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:11,代码来源:ffile__commonlib.php

示例6: lxshell_expect

function lxshell_expect($strtype, $cmd)
{
    global $gbl, $sgbl, $login, $ghtml;
    $a = array("ntfsresize" => "expect \"Are you sure you want to proceed (y/[n])? \"\nsend \"y\\r\"\n\n");
    $t = lx_tmp_file("expect");
    $string = $a['ntfsresize'];
    lfile_put_contents($t, "spawn {$cmd}\n{$string}");
    log_shell("expect {$t} {$cmd}");
    system("expect {$t}");
    //lunlink($t);
}
开发者ID:zseand,项目名称:kloxo,代码行数:11,代码来源:linuxfslib.php

示例7: createUser

 function createUser()
 {
     $domname = $this->main->getParentName();
     $dir = "__path_httpd_root/{$domname}/dirprotect/";
     $authuserfile = "{$dir}/{$this->main->getFileName()}";
     $fstr = null;
     foreach ($this->main->diruser_a as $v) {
         $crypt = crypt($v->param, $this->genSalt());
         $fstr .= "{$v->nname}:{$crypt}";
         //$fstr .= $v->nname . ':' . $v->param . "\n";
     }
     lfile_put_contents($authuserfile, $fstr);
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:13,代码来源:dirprotect__iislib.php

示例8: dosyncToSystem

 function dosyncToSystem()
 {
     global $gbl, $sgbl, $login;
     if (if_demo()) {
         return;
     }
     $_filepath = "__path_real_etc_root/hosts.deny";
     $string = null;
     foreach ((array) $this->main->__var_hostlist as $v) {
         $string .= "ALL: {$v['hostname']}\n";
     }
     if ($this->isDeleted() != "delete") {
         $string .= "ALL: {$this->main->hostname}\n";
     }
     lfile_put_contents($_filepath, $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:16,代码来源:hostdeny__windowslib.php

示例9: createDavSuexec

 function createDavSuexec()
 {
     $string = null;
     $uid = os_get_uid_from_user($this->main->__var_system_username);
     $gid = os_get_gid_from_user($this->main->__var_system_username);
     $string .= "#!/bin/sh\n";
     $string .= "export MUID={$uid}\n";
     $string .= "export GID={$gid}\n";
     $string .= " export PHPRC=/usr/local/lxlabs/ext/php/etc/php.ini\n";
     $string .= "export TARGET=<%program%>\n";
     $string .= "export NON_RESIDENT=1\n";
     $string .= "exec lxsuexec \$*\n";
     $st = str_replace("<%program%>", "/usr/local/lxlabs/ext/php/bin/php_cgi", $string);
     lfile_put_contents("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", $st);
     lxfile_unix_chmod("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", "0755");
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:16,代码来源:davuser__lighttpdlib.php

示例10: createDnsData

 function createDnsData()
 {
     dprint("DbActionAdd\n");
     $fdata = "";
     $tmp = "";
     $this->createPrimaryZone($this->main->nname);
     lfile_put_contents("c:/Windows/System32/drivers/etc/hosts", "127.0.0.1 {$this->main->nname}", FILE_APPEND);
     return;
     if ($this->main->ns_rec_a != '') {
         foreach ($this->main->ns_rec_a as $value) {
             $this->createNSRecord($this->main->nname, $value->nname);
         }
     }
     if ($this->main->mx_rec_a != '') {
         foreach ($this->main->mx_rec_a as $o) {
             $this->createMxRecord($this->main->nname, 'something', $o->param, $o->nname);
         }
     }
     if ($this->main->a_rec_a) {
         foreach ($this->main->a_rec_a as $o) {
             $key = $o->nname;
             $value = $o->param;
             if ($o->param === null) {
                 continue;
             }
             $this->createARecord($this->main->nname, $key, $value);
         }
     }
     if ($this->main->cn_rec_a != '') {
         foreach ($this->main->cn_rec_a as $o) {
             $key = $o->nname;
             $value = $o->param;
             if ($o->param === null) {
                 continue;
             }
             $key .= ".{$this->main->nname}.";
             if ($value !== "__base__") {
                 $value = "{$value}.{$this->main->nname}.";
             } else {
                 $value = "{$this->main->nname}.";
             }
             $fdata .= $tmp;
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:45,代码来源:dns__msdnslib.php

示例11: createMainFile

 function createMainFile()
 {
     global $gbl, $sgbl, $login, $ghtml;
     list($base, $end) = reversedns::getBaseEnd($this->main->nname, $this->main->__var_rdnsrange);
     $string = null;
     $transferstring = null;
     if ($this->main->__var_transferip) {
         $transferstring = "allow-transfer { {$this->main->__var_transferip}; };";
     }
     foreach ($this->main->__var_reverse_list as $k => $v) {
         if ($k === $base) {
             continue;
         }
         $string .= "zone \"{$k}.in-addr.arpa\" {type master; file \"{$sgbl->__path_named_path}/{$k}.in-addr.arpa\"; {$transferstring}};\n\n";
     }
     $string .= "zone \"{$base}.in-addr.arpa\" {type master; file \"{$sgbl->__path_named_path}/{$base}.in-addr.arpa\"; {$transferstring}};\n\n";
     lfile_put_contents("__path_named_chroot/etc/lxreverse.conf", $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:reversedns__bindlib.php

示例12: changeSuperAdminPass

 function changeSuperAdminPass()
 {
     if ($this->nname === 'superadmin') {
         $oldpass = getAdminDbPass();
         $newp = client::createDbPass($this->realpass);
         $return = lfile_put_contents("__path_super_pass", $newp);
         if (!$return) {
             log_log("admin_error", "Admin pass change failed  {$last_error}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
         $return = $sql->setPassword($newp);
         if ($return) {
             $return = lfile_put_contents("__path_super_pass", $oldpass);
             log_log("admin_error", "mysqladmin Failed . {$out}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:superclientlib.php

示例13: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    $db = $sgbl->__var_dbf;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        // TODO: REPLACE MYSQL_CONNECT
        // TUT TUT naughty programmer... We are creating the db now XD
        $req = mysqli_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$db}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user: " . mysqli_connect_error() . "\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysqli_query($req, "CREATE DATABASE {$dbname}");
        mysqli_query($req, "GRANT ALL ON {$dbname}.* TO '{$pguser}'@'localhost' IDENTIFIED BY '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:44,代码来源:initlib.php

示例14: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        $req = mysql_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$sgbl->__var_dbf}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysql_query("create database {$dbname}");
        mysql_query("grant all on {$dbname}.* to '{$pguser}'@'localhost' identified by '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:41,代码来源:initlib.php

示例15: readAuthorizedKey

 static function readAuthorizedKey($username)
 {
     $p = os_get_home_dir($username);
     if ($p === '/tmp' && $username) {
         lxfile_mkdir("/home/{$username}");
         lxshell_return("usermod", "-d", "/home/{$username}", $username);
         lxfile_unix_chown_rec("/home/{$username}", "{$username}:{$username}");
         $p = "/home/{$username}";
     }
     if (!$p) {
         return;
     }
     $f = "{$p}/.ssh/authorized_keys";
     if (lxfile_exists("{$f}2")) {
         $s = lfile_get_contents("{$f}2");
         $s = "\n{$s}\n";
         lfile_put_contents($f, $s, FILE_APPEND);
         lunlink("{$f}2");
     }
     return lfile_get_contents($f);
 }
开发者ID:digideskio,项目名称:hypervm,代码行数:21,代码来源:sshauthorizedkey__sync.php


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