| 1 |
#!/usr/bin/perl |
|---|
| 2 |
|
|---|
| 3 |
# ispCP ω (OMEGA) a Virtual Hosting Control Panel |
|---|
| 4 |
# Copyright (c) 2001-2006 by moleSoftware GmbH |
|---|
| 5 |
# http://www.molesoftware.com |
|---|
| 6 |
# Copyright (c) 2006-2007 by isp Control Panel |
|---|
| 7 |
# http://isp-control.net |
|---|
| 8 |
# |
|---|
| 9 |
# |
|---|
| 10 |
# License: |
|---|
| 11 |
# This program is free software; you can redistribute it and/or |
|---|
| 12 |
# modify it under the terms of the MPL Mozilla Public License |
|---|
| 13 |
# as published by the Free Software Foundation; either version 1.1 |
|---|
| 14 |
# of the License, or (at your option) any later version. |
|---|
| 15 |
# |
|---|
| 16 |
# This program is distributed in the hope that it will be useful, |
|---|
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 |
# MPL Mozilla Public License for more details. |
|---|
| 20 |
# |
|---|
| 21 |
# You may have received a copy of the MPL Mozilla Public License |
|---|
| 22 |
# along with this program. |
|---|
| 23 |
# |
|---|
| 24 |
# An on-line copy of the MPL Mozilla Public License can be found |
|---|
| 25 |
# http://www.mozilla.org/MPL/MPL-1.1.html |
|---|
| 26 |
# |
|---|
| 27 |
# |
|---|
| 28 |
# The ispCP ω Home Page is at: |
|---|
| 29 |
# |
|---|
| 30 |
# http://isp-control.net |
|---|
| 31 |
# |
|---|
| 32 |
|
|---|
| 33 |
use FindBin; |
|---|
| 34 |
|
|---|
| 35 |
use lib "$FindBin::Bin/../engine"; |
|---|
| 36 |
require 'ispcp_common_methods.pl'; |
|---|
| 37 |
|
|---|
| 38 |
use strict; |
|---|
| 39 |
use warnings; |
|---|
| 40 |
|
|---|
| 41 |
die ("Undefined Input Data!") if (!defined($ARGV[0]) || !defined($ARGV[1]) || !defined($ARGV[2])); |
|---|
| 42 |
|
|---|
| 43 |
my ($php_fname, $perl_fname, $perl_fname2) = ($ARGV[0], $ARGV[1], $ARGV[2]); |
|---|
| 44 |
|
|---|
| 45 |
my $key = gen_sys_rand_num(32); |
|---|
| 46 |
my $iv = gen_sys_rand_num(8); |
|---|
| 47 |
|
|---|
| 48 |
$key =~ s/'/\\'/gi; |
|---|
| 49 |
$iv =~ s/'/\\'/gi; |
|---|
| 50 |
|
|---|
| 51 |
# remove \n at the end of lines; |
|---|
| 52 |
|
|---|
| 53 |
chop($key); |
|---|
| 54 |
chop($iv); |
|---|
| 55 |
|
|---|
| 56 |
my ($rs, $php_file, $perl_file) = (undef, undef, undef); |
|---|
| 57 |
|
|---|
| 58 |
my %tag_hash = ( |
|---|
| 59 |
'{KEY}' => $key, |
|---|
| 60 |
'{IV}' => $iv |
|---|
| 61 |
); |
|---|
| 62 |
|
|---|
| 63 |
# php lib; |
|---|
| 64 |
|
|---|
| 65 |
$php_file = get_file($php_fname); |
|---|
| 66 |
|
|---|
| 67 |
($rs, $php_file) = prep_tpl(\%tag_hash, $php_file); |
|---|
| 68 |
|
|---|
| 69 |
return $rs if ($rs != 0); |
|---|
| 70 |
|
|---|
| 71 |
$rs = save_file($php_fname, $php_file); |
|---|
| 72 |
|
|---|
| 73 |
return $rs if ($rs != 0); |
|---|
| 74 |
|
|---|
| 75 |
# perl lib; |
|---|
| 76 |
|
|---|
| 77 |
$perl_file = get_file($perl_fname); |
|---|
| 78 |
|
|---|
| 79 |
($rs, $perl_file) = prep_tpl(\%tag_hash, $perl_file); |
|---|
| 80 |
|
|---|
| 81 |
return $rs if ($rs != 0); |
|---|
| 82 |
|
|---|
| 83 |
$rs = save_file($perl_fname, $perl_file); |
|---|
| 84 |
|
|---|
| 85 |
return $rs if ($rs != 0); |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
# perl lib for autoresponder; |
|---|
| 89 |
|
|---|
| 90 |
$rs = save_file($perl_fname2, $perl_file); |
|---|
| 91 |
|
|---|
| 92 |
return $rs if ($rs != 0); |
|---|