本文整理汇总了PHP中lfile_get_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP lfile_get_contents函数的具体用法?PHP lfile_get_contents怎么用?PHP lfile_get_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lfile_get_contents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restoreFromTrash
static function restoreFromTrash($user, $root, $name)
{
$trashcont = "{$root}/.trash/.__trash_" . basename($name);
$dst = trim(lfile_get_contents($trashcont));
new_process_mv_rec($user, "{$root}/.trash/" . basename($name), "{$root}/{$dst}");
lxfile_rm("{$root}/.trash/.__trash_" . basename($name));
}
示例2: mebackup_main
function mebackup_main()
{
global $gbl, $sgbl, $login, $ghtml;
$progname = $sgbl->__var_program_name;
$cprogname = ucfirst($progname);
initProgram('admin');
lxfile_mkdir("__path_program_home/selfbackup/self/__backup");
$backup = $login->getObject('general')->selfbackupparam_b;
$dbf = $sgbl->__var_dbf;
$pass = trim(lfile_get_contents("__path_program_root/etc/conf/{$progname}.pass"));
$vd = createTempDir("/tmp", "mebackup");
$docf = "{$vd}/mebackup.dump";
// Issue #671 - Fixed backup-restore issue
// exec("exec mysqldump --add-drop-table -u $progname -p$pass $dbf > $docf");
system("exec mysqldump --add-drop-table -u {$progname} -p{$pass} {$dbf} > {$docf}");
$string = @date('Y-M-d') . '-' . time();
$bfile = "{$sgbl->__path_program_home}/selfbackup/self/__backup/{$progname}-scheduled-masterselfbackup-{$string}.zip";
lxshell_zip($vd, $bfile, array("mebackup.dump"));
lxfile_tmp_rm_rec($vd);
if ($backup && $backup->isOn('selfbackupflag')) {
try {
lxbackup::upload_to_server($bfile, basename($bfile), $backup);
} catch (Exception $e) {
print "Sending warning to {$login->contactemail} ..\n";
lx_mail(null, $login->contactemail, "{$cprogname} Self Database Backup Upload Failed on " . date('Y-M-d') . " at " . date('H') . " Hours", "{$cprogname} Backup upload Failed due to {$e->getMessage()}\n");
}
}
$backup->rm_last_number = 20;
$backup->nname = 'masterselfbackup';
lxbackup::clear_extra_backups('selfbackup', 'self', $backup);
}
示例3: child_main
function child_main()
{
global $argv;
//sleep(100);
ob_start();
$rem = unserialize(lfile_get_contents($argv[1]));
unlink($argv[1]);
if (!$rem) {
exit;
}
if (isset($rem->sleep)) {
sleep($rem->sleep);
}
if ($rem->__type == 'object') {
$func = $rem->func;
$ret = $rem->__exec_object->{$func}();
} else {
// Merged from 6.1.x/kloxo/bin/common/child.php (revision 472)
// workaround for the following php bug:
// http://bugs.php.net/bug.php?id=47948
// http://bugs.php.net/bug.php?id=51329
if (is_array($rem->func) && count($rem->func) > 0) {
$class = $rem->func[0];
class_exists($class);
}
// ---
$ret = call_user_func_array($rem->func, $rem->arglist);
}
$var = base64_encode(serialize($ret));
ob_end_clean();
print $var;
exit;
}
示例4: security_blanket_main
function security_blanket_main()
{
global $argv;
//sleep(100);
$rem = unserialize(lfile_get_contents($argv[1]));
unlink($argv[1]);
if (!$rem) {
exit;
}
// Merged from 6.1.x/kloxo/bin/common/securityblanket.php (revision 472)
// workaround for the following php bug:
// http://bugs.php.net/bug.php?id=47948
// http://bugs.php.net/bug.php?id=51329
if (is_array($rem->func) && count($rem->func) > 0) {
$class = $rem->func[0];
class_exists($class);
}
// ---
call_user_func_array($rem->func, $rem->arglist);
$sq = new Sqlite(null, $rem->table);
$res = $sq->getRowsWhere("nname = '{$rem->nname}'", array($rem->flagvariable));
if ($res[0][$rem->flagvariable] === 'doing') {
$sq->rawQuery("update {$rem->table} set {$rem->flagvariable} = 'Program Got aborted in the midst. Please try again.' where nname = '{$rem->nname}'");
}
}
示例5: background_main
function background_main()
{
global $argv;
//sleep(100);
$rem = unserialize(lfile_get_contents($argv[1]));
unlink($argv[1]);
if (!$rem) {
exit;
}
if (isset($rem->sleep)) {
sleep($rem->sleep);
}
if ($rem->__type == 'object') {
$func = $rem->func;
$rem->__exec_object->{$func}();
} else {
// workaround for the following php bug:
// http://bugs.php.net/bug.php?id=47948
// http://bugs.php.net/bug.php?id=51329
if (is_array($rem->func) && count($rem->func) > 0) {
$class = $rem->func[0];
class_exists($class);
}
// ---
call_user_func_array($rem->func, $rem->arglist);
}
}
示例6: change_lxadmin_to_kloxo
function change_lxadmin_to_kloxo($filename)
{
$string = lfile_get_contents($filename);
if (!$string) {
return;
}
$string = str_replace("Lxadmin", "Kloxo", $string);
$string = str_replace("lxadmin", "kloxo", $string);
file_put_contents($filename, $string);
}
示例7: getPaymentUrl
function getPaymentUrl()
{
$con = lfile_get_contents("../file/url.txt");
$con = str_replace("%lxmonth%", $this->month, $con);
$con = str_replace("%username%", $this->client, $con);
$p = $this->getTotalPaid();
$left = $this->total - $p;
if ($left == 0) {
return "already_paid";
}
$con = str_replace("%grand_total%", $left, $con);
return $con;
}
示例8: showRawPrint
function showRawPrint($subaction = null)
{
global $gbl, $sgbl, $login, $ghtml;
$parent = $this->getParentO();
$v = lfile_get_contents("htmllib/filecore/sshterm-applet.htm");
if ($parent->is__table('pserver')) {
$v = str_replace("%username%", "root", $v);
$ip = getFQDNforServer($parent->nname);
$sshport = db_get_value("sshconfig", $parent->nname, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
} else {
if ($parent->is__table('client')) {
if ($parent->isDisabled('shell') || !$parent->shell) {
$ghtml->print_information("pre", "updateform", "sshclient", "disabled");
exit;
}
$sshport = db_get_value("sshconfig", $parent->websyncserver, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$ghtml->print_information("pre", "updateform", "sshclient", "warning");
$ip = getFQDNforServer("localhost");
$v = str_replace("%username%", $parent->username, $v);
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
} else {
$v = str_replace("%username%", "root", $v);
$ip = $parent->getOneIP();
$sshport = db_get_value("sshconfig", $parent->syncserver, "ssh_port");
if (!$ip) {
throw new lxException("need_to_add_at_least_one_ip_to_the_vps_for_logging_in");
}
if (!$sshport) {
$sshport = "22";
}
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
}
}
print $v;
}
示例9: getCurrentIps
static function getCurrentIps()
{
global $gbl, $sgbl, $login, $ghtml;
$contents = lfile_get_contents("/etc/network/interfaces");
$string = preg_replace('/[\\n]+/', "\n", $contents);
$array = explode("auto", $string);
foreach ($array as $a12) {
$a[] = self::getArrayFromString($a12);
}
foreach ($a as $single) {
if (count($single) >= 3) {
$ret[] = $single;
}
}
return $ret;
}
示例10: showRawPrint
function showRawPrint($subaction = null)
{
global $gbl, $sgbl, $login, $ghtml;
$parent = $this->getParentO();
$lgg = $parent->getVncLogin();
$v = lfile_get_contents("htmllib/filecore/vncviewer-applet.html");
$port = 5900 + $lgg[0];
//$port = 5900;
$v = str_replace("%port%", $port, $v);
$v = str_replace("%host%", $lgg[1], $v);
$ghtml->print_curvy_table_start("100");
print "You are actually logging into the vncviewer (<b>{$lgg['1']}:{$port}</b>) on the HOST machine, which is the direct console graphical login for the vps. The password is your Control Panel password for the vps. You can also login to this vnc port <b> \"{$lgg['1']}:{$port}\" </b> using a vnc client, and there too on a successful login, you will be logged into the vps. Note that you don't need an ipaddress to be configured on the vps to use this facility. You are basically connecting to the HOST through vnc, which gives you the console access to the vps. <br>";
$ghtml->print_curvy_table_end("100");
print "<table cellpadding=0 cellspacing=0 height=10> <tr> <td ></td> </tr> </table> ";
print $v;
}
示例11: add_admin
function add_admin($pass)
{
global $gbl, $sgbl, $login, $ghtml;
$client = new Client(null, null, 'admin');
$login = $client;
$client->initThisDef();
$client->priv->pserver_num = 'Unlimited';
$client->priv->maindomain_num = 'Unlimited';
$client->priv->vps_num = 'Unlimited';
$client->priv->client_num = 'Unlimited';
$client->ddate = time();
$ddb = new Sqlite(null, "client");
if (!$ddb->existInTable("nname", 'admin')) {
if ($sgbl->dbg > 0) {
$pass = 'lxlabs';
$res['contacemail'] = 'admin@lxcenter.org';
}
$res['password'] = crypt($pass);
$res['cttype'] = 'admin';
$res['cpstatus'] = 'on';
if (if_demo()) {
$res['email'] = "admin@lxcenter.org";
}
$client->create($res);
$client->driverApp = new client__sync(null, null, 'admin');
$client->was();
lxfile_mkdir("__path_client_root/{$client->nname}");
lxfile_generic_chown("__path_client_root/{$client->nname}", "lxlabs");
}
$notif = new Notification(null, null, $client->getClName());
$notif->initThisDef();
$notif->dbaction = 'add';
$notif->text_newaccountmessage = lfile_get_contents("__path_program_root/file/welcome.txt");
$notif->parent_clname = $client->getClName();
$notif->write();
$display = new sp_SpecialPlay(null, null, $client->getClName());
$display->initThisDef();
$display->parent_clname = $client->getClName();
$display->dbaction = 'add';
$display->write();
}
示例12: showRawPrint
function showRawPrint($subaction = null)
{
global $gbl, $sgbl, $login, $ghtml;
$parent = $this->getParentO();
$parent->makeSureTheUserExists();
$lgg = $parent->getLogin();
$sshport = db_get_value("sshconfig", $parent->syncserver, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$v = lfile_get_contents("htmllib/filecore/sshterm-applet.htm");
$ip = $lgg[1];
$v = str_replace("%username%", $lgg[0], $v);
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
$string = $login->getKeyword("console_message");
$string = str_replace("%username%", "<font style='font-weight:bold'>{$lgg['0']}@{$ip}:{$sshport} </font>", $string);
print " <table cellpadding=0 cellspacing=0 width=80%> <tr> <td > {$string} <br> </td> </tr> </table> \n";
print $v;
}
示例13: 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);
}
示例14: dbactionUpdate
function dbactionUpdate($subaction)
{
if (if_demo()) {
throw new lxException("demo", $v);
}
if ($this->main->ssh_port && !($this->main->ssh_port > 0)) {
throw new lxException('invalid_ssh_port', 'ssh_port', '');
}
dprint($this->main->ssh_port);
$this->main->ssh_port = trim($this->main->ssh_port);
if (!$this->main->ssh_port) {
$port = "22";
} else {
$port = $this->main->ssh_port;
}
if (lxfile_exists("/etc/fedora-release")) {
$str = lfile_get_contents("../file/template/sshd_config-fedora-2");
} else {
$str = lfile_get_contents("../file/template/sshd_config");
}
$str = str_replace("%ssh_port%", $port, $str);
if ($this->main->isOn('without_password_flag')) {
$wt = 'without-password';
} else {
$wt = 'yes';
}
if ($this->main->isOn('disable_password_flag')) {
$pwa = 'no';
} else {
$pwa = 'yes';
}
$str = str_replace("%permit_root_login%", $wt, $str);
$str = str_replace("%permit_password%", $pwa, $str);
$ret = lfile_put_contents("/etc/ssh/sshd_config", $str);
if (!$ret) {
throw new lxException('could_not_write_config_file', '', '');
}
exec_with_all_closed("/etc/init.d/sshd restart");
}
示例15: add_line_to_master_mycnf
function add_line_to_master_mycnf()
{
global $gbl, $sgbl, $login, $ghtml;
$dbf = $sgbl->__var_dbf;
if (!lxfile_exists("/etc/primary_master.copy.my.cnf")) {
lxfile_cp("/etc/my.cnf", "/etc/primary_master.copy.my.cnf");
}
$v = lfile_get_contents("/etc/my.cnf");
if (csa($v, "binlog-do-db")) {
print "Line already exists in /etc/my.cnf\n";
return;
}
$list = lfile_trim("/etc/my.cnf");
foreach ($list as $k => $l) {
$ll[] = $l;
if ($l == '[mysqld]') {
$ll[] = "log-bin=mysql-bin";
$ll[] = "binlog-do-db={$dbf}";
$ll[] = "server-id=1";
}
}
lfile_put_contents("/etc/my.cnf", implode("\n", $ll));
system("service mysqld restart");
}