Ejemplo n.º 1
0
 public function parseIOSVideoUrlByContent($content, $p_coding, $p_script)
 {
     $videoUrlParam = getBody($content, $this->p_videocodeApiUrlParamstart, $this->p_videocodeApiUrlParamend);
     $videoUrlParam = replaceLine($videoUrlParam);
     //		var_dump($videoUrlParam);
     $p_videoUrlApi = replaceStr($this->p_videocodeApiUrl, "{PROD_ID}", $videoUrlParam);
     $videoUrlApiCode = getPageWindow($p_videoUrlApi, $this->p_code);
     $videoAddressUrl = getBody($videoUrlApiCode, $this->p_videourlstart, $this->p_videourlend);
     return $videoAddressUrl;
 }
Ejemplo n.º 2
0
 public function configure_amavis()
 {
     global $conf;
     // amavisd user config file
     $configfile = 'fedora_amavisd_conf';
     if (is_file($conf["amavis"]["config_dir"] . '/amavisd.conf')) {
         copy($conf["amavis"]["config_dir"] . '/amavisd.conf', $conf["amavis"]["config_dir"] . '/amavisd.conf~');
     }
     if (is_file($conf["amavis"]["config_dir"] . '/amavisd.conf~')) {
         exec('chmod 400 ' . $conf["amavis"]["config_dir"] . '/amavisd.conf~');
     }
     if (!is_dir($conf["amavis"]["config_dir"])) {
         mkdir($conf["amavis"]["config_dir"]);
     }
     $content = rf("tpl/" . $configfile . ".master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
     $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
     $content = str_replace('{hostname}', $conf['hostname'], $content);
     $content = str_replace('/var/spool/amavisd/clamd.sock', '/var/run/clamav/clamd.sock', $content);
     wf($conf["amavis"]["config_dir"] . '/amavisd.conf', $content);
     // Adding the amavisd commands to the postfix configuration
     $postconf_commands = array('content_filter = amavis:[127.0.0.1]:10024', 'receive_override_options = no_address_mappings');
     // Make a backup copy of the main.cf file
     copy($conf["postfix"]["config_dir"] . '/main.cf', $conf["postfix"]["config_dir"] . '/main.cf~2');
     // Executing the postconf commands
     foreach ($postconf_commands as $cmd) {
         $command = "postconf -e '{$cmd}'";
         caselog($command . " &> /dev/null", __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     // Append the configuration for amavisd to the master.cf file
     if (is_file($conf["postfix"]["config_dir"] . '/master.cf')) {
         copy($conf["postfix"]["config_dir"] . '/master.cf', $conf["postfix"]["config_dir"] . '/master.cf~');
     }
     $content = rf($conf["postfix"]["config_dir"] . '/master.cf');
     // Only add the content if we had not addded it before
     if (!stristr($content, "127.0.0.1:10025")) {
         unset($content);
         $content = rf("tpl/master_cf_amavis.master");
         af($conf["postfix"]["config_dir"] . '/master.cf', $content);
     }
     unset($content);
     removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
     replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
 }
Ejemplo n.º 3
0
}
if (isset($_POST['coupon'])) {
    $cc = $_POST['codecoupon'];
    $disc = $_POST['discount'];
    $dd = $_POST['date'];
    $use = $_POST['use'];
    if (empty($cc) || empty($disc) || empty($dd)) {
        $msg = $lang['alert_one_or_more_fields_are_required'];
    }
    if (file_exists("db/coupon/sessions.dat")) {
        $content = @file_get_contents("db/coupon/sessions.dat");
    }
    $list = empty($content) ? 'null' : $content;
    $data = $cp_id . '|' . $cc . '|' . $disc . '|' . strtotime($dd) . '|' . $use . '|' . $list . '|';
    if ($_POST['update'] == 'update') {
        replaceLine('db/coupon/' . $CouponData . '.dat', $cp_id, $data);
        $dir = 'ok';
    } else {
        if (empty($msg)) {
            $fp = fopen("db/coupon/{$CouponData}.dat", "a");
            fwrite($fp, $data . "\n");
            fclose($fp);
            if (file_exists("db/coupon/sessions.dat")) {
                @unlink("db/coupon/sessions.dat");
            }
            $dir = 'new';
            if (file_exists("db/coupon/sessions.dat")) {
                @unlink("db/coupon/sessions.dat");
            }
        }
    }
Ejemplo n.º 4
0
            $address2 = "null";
        }
        if (empty($_POST['state'])) {
            $state = "null";
        }
        if (empty($_POST['password'])) {
            $password = $data[14];
        } else {
            $password = password_encode($key, $password);
        }
        $profile = $data[0] . '|' . $data[1] . '|' . $data[2] . '|' . $data[3] . '|' . $data[4] . '|' . $company . '|' . $email . '|' . $phone . '|' . $address . '|' . $address2 . '|' . $city . '|' . $state . '|' . $zip . '|' . $country . '|' . $password . '|';
        if ($email != $data[6]) {
            if (file_exists("{$AdminFolder}/db/newsletter/{$NewsletterData}.dat")) {
                $ct = @file_get_contents("{$AdminFolder}/db/newsletter/{$NewsletterData}.dat");
                if (preg_match('|\\b' . preg_quote($data[6]) . '\\b|i', $ct)) {
                    $ns = str_replace($data[6], $email, $ct);
                    $fp = fopen("{$AdminFolder}/db/newsletter/{$NewsletterData}.dat", "w");
                    fwrite($fp, $ns);
                    fclose($fp);
                }
            }
            $_SESSION["checkout"] = $data[1];
        }
        replaceLine($CustomersFile, $_POST['update'], $profile);
        header("location: checkout.php");
    }
}
$meta_title = $title . "-" . $lang['profile_title'];
$include = "lib/display_profile.php";
$design = $template;
include "templates/" . $design . "/index.php";
Ejemplo n.º 5
0
 public function configure_apache()
 {
     global $conf;
     if ($conf['apache']['installed'] == false) {
         return;
     }
     //* Create the logging directory for the vhost logfiles
     if (!is_dir($conf['ispconfig_log_dir'] . '/httpd')) {
         mkdir($conf['ispconfig_log_dir'] . '/httpd', 0755, true);
     }
     if (is_file($conf['suphp']['config_file'])) {
         $content = rf($conf['suphp']['config_file']);
         if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content)) {
             $content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
             $content = preg_replace('/;?umask=\\d+/', 'umask=0022', $content);
         }
         $this->write_config_file($conf['suphp']['config_file'], $content);
     }
     //* Enable ISPConfig default vhost settings
     $default_vhost_path = $conf['apache']['vhost_conf_dir'] . '/' . $conf['apache']['vhost_default'];
     if (is_file($default_vhost_path)) {
         $content = rf($default_vhost_path);
         $content = preg_replace('/^#?\\s*NameVirtualHost.*$/m', 'NameVirtualHost *:80', $content);
         $content = preg_replace('/<VirtualHost[^>]+>/', '<VirtualHost *:80>', $content);
         $this->write_config_file($default_vhost_path, $content);
     }
     //* Generate default ssl certificates
     if (!is_dir($conf['apache']['ssl_dir'])) {
         mkdir($conf['apache']['ssl_dir']);
     }
     if ($conf['services']['mail'] == true) {
         copy($conf['postfix']['config_dir'] . "/smtpd.key", $conf['apache']['ssl_dir'] . "/server.key");
         copy($conf['postfix']['config_dir'] . "/smtpd.cert", $conf['apache']['ssl_dir'] . "/server.crt");
     } else {
         if (!is_file($conf['apache']['ssl_dir'] . '/server.crt')) {
             exec("openssl req -new -outform PEM -out {$conf['apache']['ssl_dir']}/server.crt -newkey rsa:2048 -nodes -keyout {$conf['apache']['ssl_dir']}/server.key -keyform PEM -days 365 -x509");
         }
     }
     //* Copy the ISPConfig configuration include
     $content = $this->get_template_file('apache_ispconfig.conf', true);
     $records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = " . $conf["server_id"] . " AND virtualhost = 'y'");
     if (is_array($records) && count($records) > 0) {
         foreach ($records as $rec) {
             $content .= "NameVirtualHost " . $rec["ip_address"] . ":80\n";
             $content .= "NameVirtualHost " . $rec["ip_address"] . ":443\n";
         }
     }
     $this->write_config_file($conf['apache']['vhost_conf_dir'] . '/000-ispconfig.conf', $content);
     //* Gentoo by default does not include .vhost files. Add include line to config file.
     $content = rf($conf['apache']['config_file']);
     if (strpos($content, 'Include /etc/apache2/vhosts.d/*.vhost') === false) {
         $content = preg_replace('|(Include /etc/apache2/vhosts.d/\\*.conf)|', "\$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
     }
     $this->write_config_file($conf['apache']['config_file'], $content);
     //* make sure that webalizer finds its config file when it is directly in /etc
     if (is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer')) {
         mkdir('/etc/webalizer', 0755);
         symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
     }
     if (is_file('/etc/webalizer/webalizer.conf')) {
         replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
     }
     //* add a sshusers group
     if (!is_group('sshusers')) {
         $command = 'groupadd sshusers';
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
 }
Ejemplo n.º 6
0
 public function install_ispconfig()
 {
     global $conf;
     $install_dir = $conf['ispconfig_install_dir'];
     //* Create the ISPConfig installation directory
     if (!@is_dir("{$install_dir}")) {
         $command = "mkdir {$install_dir}";
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* Create a ISPConfig user and group
     $command = 'groupadd ispconfig';
     if (!is_group('ispconfig')) {
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     $command = "useradd -g ispconfig -d {$install_dir} ispconfig";
     if (!is_user('ispconfig')) {
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* copy the ISPConfig interface part
     $command = "cp -rf ../interface {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* copy the ISPConfig server part
     $command = "cp -rf ../server {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Create a symlink, so ISPConfig is accessible via web
     // Replaced by a separate vhost definition for port 8080
     // $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig";
     // caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
     //* Create the config file for ISPConfig interface
     $configfile = 'config.inc.php';
     if (is_file($install_dir . '/interface/lib/' . $configfile)) {
         copy("{$install_dir}/interface/lib/{$configfile}", "{$install_dir}/interface/lib/{$configfile}~");
     }
     $content = rf("tpl/{$configfile}.master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
     $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
     $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
     $content = str_replace('{language}', $conf['language'], $content);
     wf("{$install_dir}/interface/lib/{$configfile}", $content);
     //* Create the config file for ISPConfig server
     $configfile = 'config.inc.php';
     if (is_file($install_dir . '/server/lib/' . $configfile)) {
         copy("{$install_dir}/server/lib/{$configfile}", "{$install_dir}/interface/lib/{$configfile}~");
     }
     $content = rf("tpl/{$configfile}.master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
     $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
     $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
     $content = str_replace('{language}', $conf['language'], $content);
     wf("{$install_dir}/server/lib/{$configfile}", $content);
     //* Create the config file for remote-actions (but only, if it does not exist, because
     //  the value is a autoinc-value and so changed by the remoteaction_core_module
     if (!file_exists($install_dir . '/server/lib/remote_action.inc.php')) {
         $content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
         wf($install_dir . '/server/lib/remote_action.inc.php', $content);
     }
     //* Enable the server modules and plugins.
     // TODO: Implement a selector which modules and plugins shall be enabled.
     $dir = $install_dir . '/server/mods-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/mods-available/' . $file;
                     $module_name = substr($file, 0, -8);
                     $tmp = new $module_name();
                     if ($tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/mods-enabled/' . $file)) {
                             @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-enabled/' . $file);
                         }
                         if (strpos($file, '_core_module') !== false) {
                             if (!@is_link($install_dir . '/server/mods-core/' . $file)) {
                                 @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-core/' . $file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
         }
     }
     $dir = $install_dir . '/server/plugins-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') {
                     continue;
                 }
                 if ($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') {
                     continue;
                 }
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/plugins-available/' . $file;
                     $plugin_name = substr($file, 0, -8);
                     $tmp = new $plugin_name();
                     if ($tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/plugins-enabled/' . $file)) {
                             @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-enabled/' . $file);
                         }
                         if (strpos($file, '_core_plugin') !== false) {
                             if (!@is_link($install_dir . '/server/plugins-core/' . $file)) {
                                 @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-core/' . $file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
         }
     }
     // Update the server config
     $mail_server_enabled = $conf['services']['mail'] ? 1 : 0;
     $web_server_enabled = $conf['services']['web'] ? 1 : 0;
     $dns_server_enabled = $conf['services']['dns'] ? 1 : 0;
     $file_server_enabled = $conf['services']['file'] ? 1 : 0;
     $db_server_enabled = $conf['services']['db'] ? 1 : 0;
     $vserver_server_enabled = $conf['services']['vserver'] ? 1 : 0;
     $sql = "UPDATE `server` SET mail_server = '{$mail_server_enabled}', web_server = '{$web_server_enabled}', dns_server = '{$dns_server_enabled}', file_server = '{$file_server_enabled}', db_server = '{$db_server_enabled}', vserver_server = '{$vserver_server_enabled}' WHERE server_id = " . intval($conf['server_id']);
     if ($conf['mysql']['master_slave_setup'] == 'y') {
         $this->dbmaster->query($sql);
         $this->db->query($sql);
     } else {
         $this->db->query($sql);
     }
     //* Chmod the files
     $command = "chmod -R 750 {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* chown the files to the ispconfig user and group
     $command = "chown -R ispconfig:ispconfig {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Make the global language file directory group writable
     exec("chmod -R 770 {$install_dir}/interface/lib/lang");
     //* Make the temp directory for language file exports writable
     exec("chmod -R 770 {$install_dir}/interface/web/temp");
     //* Make all interface language file directories group writable
     $handle = @opendir($install_dir . '/interface/web');
     while ($file = @readdir($handle)) {
         if ($file != '.' && $file != '..') {
             if (@is_dir($install_dir . '/interface/web' . '/' . $file . '/lib/lang')) {
                 $handle2 = opendir($install_dir . '/interface/web' . '/' . $file . '/lib/lang');
                 chmod($install_dir . '/interface/web' . '/' . $file . '/lib/lang', 0770);
                 while ($lang_file = @readdir($handle2)) {
                     if ($lang_file != '.' && $lang_file != '..') {
                         chmod($install_dir . '/interface/web' . '/' . $file . '/lib/lang/' . $lang_file, 0770);
                     }
                 }
             }
         }
     }
     //* make sure that the server config file (not the interface one) is only readable by the root user
     exec("chmod 600 {$install_dir}/server/lib/{$configfile}");
     exec("chown root:root {$install_dir}/server/lib/{$configfile}");
     if (@is_file("{$install_dir}/server/lib/mysql_clientdb.conf")) {
         exec("chmod 600 {$install_dir}/server/lib/mysql_clientdb.conf");
         exec("chown root:root {$install_dir}/server/lib/mysql_clientdb.conf");
     }
     // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
     // and must be fixed as this will allow the apache user to read the ispconfig files.
     // Later this must run as own apache server or via suexec!
     if ($conf['apache']['installed'] == true) {
         $command = 'groupmod --add-user ' . $conf['apache']['user'] . ' ispconfig';
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         if (is_group('ispapps')) {
             $command = 'groupmod --add-user ' . $conf['apache']['user'] . ' ispapps';
             caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         }
     }
     if ($conf['nginx']['installed'] == true) {
         $command = 'groupmod --add-user ' . $conf['nginx']['user'] . ' ispconfig';
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         if (is_group('ispapps')) {
             $command = 'groupmod --add-user ' . $conf['nginx']['user'] . ' ispapps';
             caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         }
     }
     //* Make the shell scripts executable
     $command = "chmod +x {$install_dir}/server/scripts/*.sh";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     if ($conf['apache']['installed'] == true) {
         //* Copy the ISPConfig vhost for the controlpanel
         // TODO: These are missing! should they be "vhost_dist_*_dir" ?
         $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
         $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
         // Dont just copy over the virtualhost template but add some custom settings
         $content = rf("tpl/apache_ispconfig.vhost.master");
         $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
         // comment out the listen directive if port is 80 or 443
         if ($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
             $content = str_replace('{vhost_port_listen}', '#', $content);
         } else {
             $content = str_replace('{vhost_port_listen}', '', $content);
         }
         if (is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
             $content = str_replace('{ssl_comment}', '', $content);
         } else {
             $content = str_replace('{ssl_comment}', '#', $content);
         }
         $content = str_replace('/var/www/', '/srv/www/', $content);
         wf("{$vhost_conf_dir}/ispconfig.vhost", $content);
         if (!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
             exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
             exec('cp tpl/apache_ispconfig_fcgi_starter.master /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
             exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
             exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
             exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
         }
         //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
         //* and create the symlink
         if ($this->install_ispconfig_interface == true && $this->is_update == false) {
             if (@is_link("{$vhost_conf_enabled_dir}/ispconfig.vhost")) {
                 unlink("{$vhost_conf_enabled_dir}/ispconfig.vhost");
             }
             if (!@is_link("{$vhost_conf_enabled_dir}/000-ispconfig.vhost")) {
                 exec("ln -s {$vhost_conf_dir}/ispconfig.vhost {$vhost_conf_enabled_dir}/000-ispconfig.vhost");
             }
         }
         // Fix a setting in vhost master file for suse
         replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master', "suPHP_UserGroup", "        suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>", 0);
     }
     if ($conf['nginx']['installed'] == true) {
         //* Copy the ISPConfig vhost for the controlpanel
         $vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
         $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
         // Dont just copy over the virtualhost template but add some custom settings
         $content = rf('tpl/nginx_ispconfig.vhost.master');
         $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
         if (is_file($install_dir . '/interface/ssl/ispserver.crt') && is_file($install_dir . '/interface/ssl/ispserver.key')) {
             $content = str_replace('{ssl_on}', ' ssl', $content);
             $content = str_replace('{ssl_comment}', '', $content);
             $content = str_replace('{fastcgi_ssl}', 'on', $content);
         } else {
             $content = str_replace('{ssl_on}', '', $content);
             $content = str_replace('{ssl_comment}', '#', $content);
             $content = str_replace('{fastcgi_ssl}', 'off', $content);
         }
         $socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
         if (substr($socket_dir, -1) != '/') {
             $socket_dir .= '/';
         }
         if (!is_dir($socket_dir)) {
             exec('mkdir -p ' . $socket_dir);
         }
         $fpm_socket = $socket_dir . 'ispconfig.sock';
         //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
         $content = str_replace('{fpm_socket}', $fpm_socket, $content);
         wf($vhost_conf_dir . '/ispconfig.vhost', $content);
         unset($content);
         // PHP-FPM
         // Dont just copy over the php-fpm pool template but add some custom settings
         $content = rf('tpl/php_fpm_pool.conf.master');
         $content = str_replace('{fpm_pool}', 'ispconfig', $content);
         //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
         $content = str_replace('{fpm_socket}', $fpm_socket, $content);
         $content = str_replace('{fpm_user}', 'ispconfig', $content);
         $content = str_replace('{fpm_group}', 'ispconfig', $content);
         wf($conf['nginx']['php_fpm_pool_dir'] . '/ispconfig.conf', $content);
         //copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost');
         //* and create the symlink
         if ($this->install_ispconfig_interface == true && $this->is_update == false) {
             if (@is_link($vhost_conf_enabled_dir . '/ispconfig.vhost')) {
                 unlink($vhost_conf_enabled_dir . '/ispconfig.vhost');
             }
             if (!@is_link($vhost_conf_enabled_dir . '/000-ispconfig.vhost')) {
                 symlink($vhost_conf_dir . '/ispconfig.vhost', $vhost_conf_enabled_dir . '/000-ispconfig.vhost');
             }
         }
         // create symlinks from /usr/share to phpMyAdmin and SquirrelMail, if they are installed
         if (!@file_exists('/usr/share/phpmyadmin') && @is_dir('/srv/www/htdocs/phpMyAdmin')) {
             symlink('/srv/www/htdocs/phpMyAdmin/', '/usr/share/phpmyadmin');
         }
         if (!@file_exists('/usr/share/squirrelmail') && @is_dir('/srv/www/htdocs/squirrelmail')) {
             symlink('/srv/www/htdocs/squirrelmail/', '/usr/share/squirrelmail');
         }
     }
     // Make the Clamav log files readable by ISPConfig
     //exec('chmod +r /var/log/clamav/clamav.log');
     //exec('chmod +r /var/log/clamav/freshclam.log');
     //* Install the update script
     if (is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) {
         unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
     }
     exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_svn.sh');
     exec('chown root /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
     exec('chown root /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
     if (!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) {
         exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
     }
     if (!is_link('/usr/local/bin/ispconfig_update.sh')) {
         exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
     }
     //set the fast cgi starter script to executable
     //exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
     //* Make the logs readable for the ispconfig user
     if (@is_file('/var/log/mail.log')) {
         exec('chmod +r /var/log/mail.log');
     }
     if (@is_file('/var/log/mail.warn')) {
         exec('chmod +r /var/log/mail.warn');
     }
     if (@is_file('/var/log/mail.err')) {
         exec('chmod +r /var/log/mail.err');
     }
     if (@is_file('/var/log/messages')) {
         exec('chmod +r /var/log/messages');
     }
     //To enable apache to read the directories
     exec('chmod a+rx /usr/local/ispconfig');
     exec('chmod -R 751 /usr/local/ispconfig/interface');
     exec('chmod a+rx /usr/local/ispconfig/interface/web');
     //* Create the ispconfig log directory
     if (!is_dir($conf['ispconfig_log_dir'])) {
         mkdir($conf['ispconfig_log_dir']);
     }
     if (!is_file($conf['ispconfig_log_dir'] . '/ispconfig.log')) {
         exec('touch ' . $conf['ispconfig_log_dir'] . '/ispconfig.log');
     }
     if (is_user('getmail')) {
         exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
         exec('chown getmail /usr/local/bin/run-getmail.sh');
         exec('chmod 744 /usr/local/bin/run-getmail.sh');
     }
 }
Ejemplo n.º 7
0
             $fi = fopen($file, "w");
             fwrite($fi, $content);
             fclose($fi);
         }
     }
 }
 if (isset($_SESSION["checkout"])) {
     $DataCustomers = data($CustomersFile, $regex);
 } else {
     die("Invalid request");
 }
 if (isset($_SESSION['use'])) {
     $regex = $_SESSION['use'];
     $DataCoupon = data("{$AdminFolder}/db/coupon/{$CouponData}.dat", $regex);
     $replacement = $DataCoupon[0] . '|' . $DataCoupon[1] . '|' . $DataCoupon[2] . '|' . $DataCoupon[3] . '|0|' . $DataCoupon[5] . '|';
     replaceLine("{$AdminFolder}/db/coupon/{$CouponData}.dat", $regex, $replacement);
 }
 @($_SESSION["idcustomer"] = $DataCustomers[1]);
 @($_SESSION["paymentmode"] = $_POST['payment']);
 @($total_weight = $_POST["total_weight"]);
 @($SubTotal = $_POST["sub_total"]);
 @($discount = $_POST["discount"]);
 @($shipping = $_POST["shipping"]);
 @($NetTotal = $_POST["net_total"]);
 @($tax = $_POST["tax"]);
 @($shipping_mode = $_POST["shipping_mode"]);
 @($memo = $_POST["memo"]);
 @($ShippingDate = "null");
 @($tracking = "null");
 $IDcustomer = $DataCustomers[1];
 $firstN = $DataCustomers[4];
Ejemplo n.º 8
0
        if (md5(strtoupper($_POST['code'])) != $_SESSION['__img_code__']) {
            $msg[] = $lang['alert_authentification_captcha'];
        }
    }
    $ct = @file_get_contents("{$AdminFolder}/db/newsletter/{$NewsletterData}.dat");
    $Nfile = "{$AdminFolder}/db/newsletter/{$NewsletterData}.dat";
    if (empty($msg)) {
        if (!preg_match('|\\b' . preg_quote($email) . '\\b|i', $ct) && !empty($_POST['email'])) {
            $msg[] = $lang['alert_register_email_does_not_exist'];
        }
    }
    $_SESSION['email'] = $email;
    foreach ($_POST as $key => $val) {
        if (preg_match('#[\\x00-\\x1F\\x7F-\\x9F/\\\\]#', $val)) {
            $msg[] = $lang['not_authorized_characters'];
        }
    }
    $email = $_SESSION['email'];
    if (empty($msg)) {
        replaceLine($Nfile, $email);
        $_SESSION = array();
        header("location: unsubscribe.php?m=1");
    }
}
if ($_GET['m'] == 1) {
    $msg2 = '<strong><font color="#009900">' . $lang['unsubscribe_newsletter_success'] . '</strong></font>';
}
$meta_title = $title . "-" . $lang['unsubscribe_newsletter_title'];
$include = "lib/display_unsubscribe.php";
$design = $template;
include "templates/" . $design . "/index.php";
Ejemplo n.º 9
0
        fclose($fp);
    } elseif (file_exists("../db/rp/{$item_id}.dat") && empty($_POST['multiple'])) {
        unlink("../db/rp/{$item_id}.dat");
    }
    $sd = preg_replace("/<[^>]*>/", "", $description);
    $sd = mynl2br($sd, " ");
    $sd = preg_replace('/\\s\\s+/', ' ', $sd);
    $sd = substr($sd, 0, 3069) . '...';
    $di = $id . '|' . $item_id . '|' . $title . '|' . $price . '|' . $discount . '|' . $category . '|' . $subcategory . '|' . $sp_offer . '|' . $sd . '|';
    if (!empty($_POST['multiple'])) {
        $rp = $_POST['multiple'];
    } else {
        $rp = '';
    }
    if ($_POST['update'] == 'update') {
        replaceLine('../db/' . $ItemsData . '.dat', $item_id, $di);
        $dir = 'ok';
    } else {
        $fp = fopen("../db/{$ItemsData}.dat", "a");
        fwrite($fp, $di . "\n");
        fclose($fp);
        $dir = 'new';
    }
    unset($_SESSION["item_id"]);
    unset($_SESSION["upload"]);
    unset($_SESSION["edit"]);
    unset($_SESSION["subcat"]);
    header("location: items.php?msg={$dir}");
    exit;
}
?>
Ejemplo n.º 10
0
        $dt = explode('|', $line);
        return $dt;
    } else {
        return false;
    }
}
$status = $_POST['status'];
$ShippingDate = strtotime($_POST['shipping_date']);
$tracking = $_POST['tracking'];
$total = number_format($_POST['total'], 2, '.', ',');
if (isset($_POST['update_order']) && strlen($_POST['update_order']) == 32) {
    @copy('db/orders/' . $OrdersData . '.dat', 'backup/orders/' . $OrdersData . '.dat');
    @($data = db($OrdersFile, $_POST['update_order']));
    @($cu = db($CustomersFile, $_POST['update_customer']));
    $order = $data[0] . '|' . $data[1] . '|' . $data[2] . '|' . $data[3] . '|' . $data[4] . '|' . $data[5] . '|' . $data[6] . '|' . $data[7] . '|' . $data[8] . '|' . $data[9] . '|' . $data[10] . '|' . $data[11] . '|' . $data[12] . '|' . $status . '|' . $data[14] . '|' . $data[15] . '|' . $data[16] . '|' . $data[17] . '|' . $ShippingDate . '|' . $tracking . '|';
    replaceLine($OrdersFile, $_POST['update_order'], $order);
    $OrderDate = date('j M, Y', $data[3]);
    if (isset($_POST['emailconfirm'])) {
        if (file_exists("db/shipping/{$ShippingSetupData}.dat")) {
            @($fp = fopen("db/shipping/{$ShippingSetupData}.dat", "r"));
            $datasetup = fgets($fp, 255);
            fclose($fp);
            $setup = explode('|', $datasetup);
        }
        $filename = "db/orders/sc/" . $data[0] . ".dat";
        if (file_exists($filename)) {
            $tab = array();
            $ShoppingCart = '';
            $tab = file($filename);
            for ($i = 0; $i < sizeof($tab); $i++) {
                @(list($id1, $id_item, $category, $subcategory, $title1, $filename, $digital, $folder, $currency, $weight, $price, $quantity, $option1, $option2, $tax, $ship, $discount1, $discount2, $ip_name) = explode('|', $tab[$i]));
Ejemplo n.º 11
0
 public function parseAndroidVideoUrlByContent($content, $p_coding, $p_script)
 {
     $vid = getBody($content, $this->contentparmStart, $this->contentparaend);
     $vid = replaceLine($vid);
     return $this->getAndroidVideoUrl($vid, $p_coding, $p_script);
 }
Ejemplo n.º 12
0
 public function configure_nginx()
 {
     global $conf;
     if ($conf['nginx']['installed'] == false) {
         return;
     }
     //* Create the logging directory for the vhost logfiles
     if (!@is_dir($conf['ispconfig_log_dir'] . '/httpd')) {
         mkdir($conf['ispconfig_log_dir'] . '/httpd', 0755, true);
     }
     //* make sure that webalizer finds its config file when it is directly in /etc
     if (@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
         mkdir('/etc/webalizer');
         symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
     }
     if (is_file('/etc/webalizer/webalizer.conf')) {
         // Change webalizer mode to incremental
         replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
         replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
     }
     // Check the awsatst script
     if (!is_dir('/usr/share/awstats/tools')) {
         exec('mkdir -p /usr/share/awstats/tools');
     }
     if (!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) {
         symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
     }
     if (file_exists('/etc/awstats/awstats.conf.local')) {
         replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
     }
     //* add a sshusers group
     $command = 'groupadd sshusers';
     if (!is_group('sshusers')) {
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     /*
     $row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$conf["server_id"]."");
     $ip_address = gethostbyname($row["server_name"]);
     $server_name = $row["server_name"];
     
             //setup proxy.conf
     $configfile = 'proxy.conf';
     if(is_file($conf["nginx"]["config_dir"].'/'.$configfile)) copy($conf["nginx"]["config_dir"].'/'.$configfile,$conf["nginx"]["config_dir"].'/'.$configfile.'~');
     if(is_file($conf["nginx"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["nginx"]["config_dir"].'/'.$configfile.'~');
     $content = rf("tpl/nginx_".$configfile.".master");
     wf($conf["nginx"]["config_dir"].'/'.$configfile,$content);
     exec('chmod 600 '.$conf["nginx"]["config_dir"].'/'.$configfile);
     exec('chown root:root '.$conf["nginx"]["config_dir"].'/'.$configfile);
     
             //setup conf.d/cache.conf
             $configfile = 'cache.conf';
     if(is_file($conf["nginx"]["config_dir"].'/conf.d/'.$configfile)) copy($conf["nginx"]["config_dir"].'/conf.d/'.$configfile,$conf["nginx"]["config_dir"].'/conf.d/'.$configfile.'~');
     if(is_file($conf["nginx"]["config_dir"].'/conf.d/'.$configfile.'~')) exec('chmod 400 '.$conf["nginx"]["config_dir"].'/conf.d/'.$configfile.'~');
     $content = rf("tpl/nginx_".$configfile.".master");
     wf($conf["nginx"]["config_dir"].'/conf.d/'.$configfile,$content);
     exec('chmod 600 '.$conf["nginx"]["config_dir"].'/conf.d/'.$configfile);
     exec('chown root:root '.$conf["nginx"]["config_dir"].'/conf.d/'.$configfile);
     
             //setup cache directories
             mkdir('/var/cache/nginx/cache');
             exec('chown www-data:www-data /var/cache/nginx/cache');
             mkdir('/var/cache/nginx/temp');
             exec('chown www-data:www-data /var/cache/nginx/temp');
     */
 }
Ejemplo n.º 13
0
@($amount = $_POST['amount']);
$ShipMode = explode(',', $ship);
$ShipAmount = explode(',', $amount);
if (count($ShipMode) != count($ShipAmount)) {
    $msg = $lang["add_shipping_fields"];
    $minimum1 = $minimum;
    $maximum1 = $maximum;
    $ShipMode1 = $ship;
    $amount1 = $amount;
}
$id = md5(uniqid(rand()));
$page_id = empty($_POST['page_id']) ? $id : $_POST['page_id'];
if (isset($_POST['shipping']) && empty($msg)) {
    $data = $page_id . '|' . $minimum . '|' . $maximum . '|' . $local_select . '|' . $setup[3] . '|' . $ship . '|' . $amount . '|' . $setup[0] . '|' . $setup[1] . '|';
    if ($_POST['update'] == 'update') {
        replaceLine('db/shipping/' . $local_select . '.dat', $page_id, $data);
        $dir = 'ok';
    } else {
        $fp = fopen('db/shipping/' . $local_select . '.dat', 'a');
        fwrite($fp, $data . "\n");
        fclose($fp);
        $dir = 'new';
    }
    header("location: shipping.php?msg={$dir}");
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <script type="text/javascript" src="js/BarMenu.js"></script>
Ejemplo n.º 14
0
            if (preg_match('|\\b' . preg_quote($pattern) . '\\b|i', $data[2], $match)) {
                $line = $replacement;
                $exist = true;
            }
            $content .= $line;
        }
        if (isset($exist)) {
            $fi = fopen($file, "w");
            fwrite($fi, $content);
            fclose($fi);
        }
    }
}
if (isset($_GET['delete'])) {
    $delete = $_GET['delete'];
    replaceLine($filename, $delete, "");
    Header("Refresh: 0; URL=\"{$url}\"");
}
if (isset($_POST['search'])) {
    if (strlen($_POST['search']) < 2 && !empty($_POST['search'])) {
        $_GET['msg'] = 'minimum';
    }
    if (empty($_POST['search'])) {
        $_GET['msg'] = 'empty';
    }
}
if (isset($_POST['search']) && empty($msg)) {
    $result = array();
    $pattern = $_POST['search'];
    if (file_exists($filename)) {
        @($fp = fopen($filename, 'r'));
Ejemplo n.º 15
0
 public function configure_apache()
 {
     global $conf;
     if (file_exists('/etc/apache2/mods-available/fcgid.conf')) {
         replaceLine('/etc/apache2/mods-available/fcgid.conf', 'MaxRequestLen', 'MaxRequestLen 15728640', 0, 1);
     }
     parent::configure_apache();
 }
 private function getPicByUrl($url, $rate)
 {
     $content = $this->readContent($url);
     if (isset($content) && !is_null($content)) {
         $content = getBody($content, AutoDouBanParseScore::PIC_CONTENT_START, AutoDouBanParseScore::PIC_CONTENT_END);
         $picUrls = getArray($content, AutoDouBanParseScore::PIC_URL_START, AutoDouBanParseScore::PIC_URL_END);
         $picRates = getArray($content, AutoDouBanParseScore::PIC_RATES_START, AutoDouBanParseScore::PIC_RATES_END);
         $picUrlsArray = explode("{Array}", $picUrls);
         $picRatesArray = explode("{Array}", $picRates);
         $total = count($picUrlsArray);
         $tempA = array();
         for ($i = 0; $i < $total; $i++) {
             try {
                 $url = $picUrlsArray[$i];
                 $rateT = $picRatesArray[$i];
                 $rateT = replaceLine($rateT);
                 $rateA = explode("x", $rateT);
                 //	 		 $log=$url .'==='.$rateT ;
                 if (count($rateA) == 2) {
                     $rateR = intval($rateA[1]) / intval($rateA[0]);
                 }
                 //	 		 $log=$log .'==='.$rateR ;
                 $rateR = abs($rateR / $rate - 1);
                 //	 		  $log=$log .'==='.$rateR ;
                 //	 		var_dump($log );
                 //比率不能少于80%
                 if ($rateR < 0.2) {
                     $tempA[$rateR . ''] = $url;
                 }
             } catch (Exception $e) {
             }
         }
         if (count($tempA) > 0) {
             $tempAKeys = array_keys($tempA);
             sort($tempAKeys, SORT_NUMERIC);
             $pic = $tempA[$tempAKeys[0]];
             var_dump($tempA);
             //	        var_dump($tempAKeys);
             if (!isN($pic)) {
                 $pic = replaceStr($pic, 'thumb', 'photo');
             }
             if (count($tempAKeys) > 1) {
                 $pic1 = $tempA[$tempAKeys[1]];
                 if (!isN($pic1)) {
                     $pic1 = replaceStr($pic1, 'thumb', 'photo');
                     $pic = $pic . '{Array}' . $pic1;
                 }
             }
             if (count($tempAKeys) > 2) {
                 $pic1 = $tempA[$tempAKeys[2]];
                 if (!isN($pic1)) {
                     $pic1 = replaceStr($pic1, 'thumb', 'photo');
                     $pic = $pic . '{Array}' . $pic1;
                 }
             }
             if (count($tempAKeys) > 3) {
                 $pic1 = $tempA[$tempAKeys[3]];
                 if (!isN($pic1)) {
                     $pic1 = replaceStr($pic1, 'thumb', 'photo');
                     $pic = $pic . '{Array}' . $pic1;
                 }
             }
             if (!isN($pic)) {
                 return $pic;
             }
         }
     }
     return false;
 }
    list($email1, $LastName1, $FirstName1) = $data;
    $update = 'update';
}
if (!isset($update)) {
    $update = '';
}
$update = $update == 'update' ? 'update' : 'new';
if (isset($_POST['update']) && empty($msg)) {
    @($email = $_POST['email']);
    @($LastName = $_POST['lastname']);
    @($FirstName = $_POST['firstname']);
    @($id = $_POST['id']);
    $DataNewsletter = $email . '|' . $LastName . '|' . $FirstName . '|';
    if ($_POST['update'] == 'update') {
        @copy('db/newsletter/newsletter.dat', 'backup/newsletter/newsletter.dat');
        replaceLine($filename, $id, $DataNewsletter);
        $dir = 'ok';
    } else {
        $fp = fopen($filename, "a");
        fwrite($fp, $DataNewsletter . "\n");
        fclose($fp);
        $dir = 'new';
    }
    header("location: display_newsletter.php?msg={$dir}");
    exit;
}
if (isset($_GET['msg']) && $_GET['msg'] == 'send') {
    $class = 'success';
    $msg = addslashes($lang["newsletter_success"]);
}
if (isset($_GET['msg']) && $_GET['msg'] == 'ok') {
Ejemplo n.º 18
0
if (isset($_POST['update'])) {
    $dd = time();
    $name = $_POST['name'];
    $rate = $_POST['score'];
    $comments = $_POST['comments'];
    $approve = $_POST['activate'];
    if (empty($_POST['activate'])) {
        $approve = 'yes';
    }
    $comments = preg_replace("/<[^>]*>/", "", $comments);
    $comments = trim($comments);
    $comments = mynl2br($comments, '<br>');
    $comments = substr($comments, 0, 510);
    $data = $sku . '|' . $item_id . '|' . $dd . '|' . $email . '|' . $name . '|' . $rate . '|' . $approve . '|spare|' . $comments . '|';
    $data = $cu[0] . '|' . $cu[1] . '|' . $dd . '|' . $cu[3] . '|' . $name . '|' . $rate . '|' . $approve . '|spare|' . $comments . '|';
    replaceLine($ReviewFile, $cu[2], $data);
    header('location: reviews.php?msg=ok');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/BarMenu.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $charset;
?>
">
<title>Admin Area - <?php 
echo $lang["edit_review_title"];
?>
</title>
Ejemplo n.º 19
0
    $description = !get_magic_quotes_gpc() ? $description : stripslashes($description);
    $description = trim($description);
    $description = str_replace("|", " ", $description);
    $title = !get_magic_quotes_gpc() ? $title : stripslashes($title);
    $title = str_replace("|", " ", $title);
    $data = $page_id . '|' . $title . '|' . $pageorder . '|' . $link . '|' . $url . '|' . $urlrewriting . '|' . $target . '|' . $meta_keywords . '|' . $meta_description . '|' . $registered . '|' . $description;
    $fp = fopen("../pages/{$page_id}.dat", "w");
    fwrite($fp, $data . "\n");
    fclose($fp);
    $SearchDescription = preg_replace("/<[^>]*>/", "", $description);
    $SearchDescription = preg_replace('/\\s\\s+/', ' ', $SearchDescription);
    $SearchDescription = mynl2br($SearchDescription, ' ');
    $SearchDescription = substr($SearchDescription, 0, 1024) . '...';
    $DataPage = $pageorder . '|' . $page_id . '|' . $title . '|' . $link . '|' . $url . '|' . $urlrewriting . '|' . $target . '|' . $registered . '|' . trim($SearchDescription) . '|';
    if ($_POST['update'] == 'update') {
        replaceLine('../db/' . $PagesData . '.dat', $page_id, $DataPage);
        $dir = 'ok';
    } else {
        $fp = fopen("../db/{$PagesData}.dat", "a");
        fwrite($fp, $DataPage . "\n");
        fclose($fp);
        $dir = 'new';
    }
    header("location: pages.php?msg={$dir}");
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/BarMenu.js"></script>
     $lines = file($filename);
     $x = 0;
     foreach ($lines as $thisline) {
         $thisline = trim($thisline);
         if (!empty($thisline)) {
             @(list($id, $id_item, $category, $subcategory, $title, $filename2, $digital, $spare, $currency, $weight, $price, $quantity, $option1, $option2, $tax, $ship, $discount1, $discount2, $ip_name, $session_cart) = explode('|', $thisline));
             $pr = db('db/' . $ItemsData . '.dat', $id_item);
             $ActualPrice = $pr[4] != 'null' && $pr[4] < $pr[3] ? $pr[4] : $pr[3];
             if ($discount1 != 'null' || $discount2 != 'null') {
                 $discount = true;
             }
             if ($ActualPrice != $price || isset($discount)) {
                 $discount1 = 'null';
                 $discount2 = 'null';
                 $data = $id . '|' . $id_item . '|' . $category . '|' . $subcategory . '|' . $title . '|' . $filename2 . '|' . $digital . '|' . $spare . '|' . $currency . '|' . $weight . '|' . $ActualPrice . '|' . $quantity . '|' . $option1 . '|' . $option2 . '|' . $tax . '|' . $ship . '|' . $discount1 . '|' . $discount2 . '|' . $ip_name . '|' . $session_cart . '|';
                 replaceLine($filename, $id_item, $data);
                 $x++;
                 if ($ActualPrice != $price) {
                     $z = $x;
                 } else {
                     $z = 0;
                     $coupon = true;
                 }
             }
         }
     }
 }
 $_SESSION["restore"] = 'yes';
 $dir = $z > 0 ? 'cart.php?price=new' : 'cart.php';
 if ($z > 0) {
     $dir = 'cart.php?price=new';
 public function install_ispconfig()
 {
     global $conf;
     $install_dir = $conf['ispconfig_install_dir'];
     //* Create the ISPConfig installation directory
     if (!@is_dir("{$install_dir}")) {
         $command = "mkdir {$install_dir}";
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* Create a ISPConfig user and group
     $command = 'groupadd ispconfig';
     if (!is_group('ispconfig')) {
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     $command = "useradd -g ispconfig -d {$install_dir} ispconfig";
     if (!is_user('ispconfig')) {
         caselog($command . ' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     }
     //* copy the ISPConfig interface part
     $command = "cp -rf ../interface {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* copy the ISPConfig server part
     $command = "cp -rf ../server {$install_dir}";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Make a backup of the security settings
     if (is_file('/usr/local/ispconfig/security/security_settings.ini')) {
         copy('/usr/local/ispconfig/security/security_settings.ini', '/usr/local/ispconfig/security/security_settings.ini~');
     }
     //* copy the ISPConfig security part
     $command = 'cp -rf ../security ' . $install_dir;
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Apply changed security_settings.ini values to new security_settings.ini file
     if (is_file('/usr/local/ispconfig/security/security_settings.ini~')) {
         $security_settings_old = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini~'));
         $security_settings_new = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
         if (is_array($security_settings_new) && is_array($security_settings_old)) {
             foreach ($security_settings_new as $section => $sval) {
                 if (is_array($sval)) {
                     foreach ($sval as $key => $val) {
                         if (isset($security_settings_old[$section]) && isset($security_settings_old[$section][$key])) {
                             $security_settings_new[$section][$key] = $security_settings_old[$section][$key];
                         }
                     }
                 }
             }
             file_put_contents('/usr/local/ispconfig/security/security_settings.ini', array_to_ini($security_settings_new));
         }
     }
     //* Create a symlink, so ISPConfig is accessible via web
     // Replaced by a separate vhost definition for port 8080
     // $command = "ln -s $install_dir/interface/web/ /home/www/ispconfig";
     // caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
     //* Create the config file for ISPConfig interface
     $configfile = 'config.inc.php';
     if (is_file($install_dir . '/interface/lib/' . $configfile)) {
         copy("{$install_dir}/interface/lib/{$configfile}", "{$install_dir}/interface/lib/{$configfile}~");
     }
     $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $configfile . '.master', "tpl/{$configfile}.master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
     $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
     $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
     $content = str_replace('{language}', $conf['language'], $content);
     $content = str_replace('{timezone}', $conf['timezone'], $content);
     $content = str_replace('{theme}', $conf['theme'], $content);
     $content = str_replace('{language_file_import_enabled}', $conf['language_file_import_enabled'] == true ? 'true' : 'false', $content);
     wf("{$install_dir}/interface/lib/{$configfile}", $content);
     //* Create the config file for ISPConfig server
     $configfile = 'config.inc.php';
     if (is_file($install_dir . '/server/lib/' . $configfile)) {
         copy("{$install_dir}/server/lib/{$configfile}", "{$install_dir}/interface/lib/{$configfile}~");
     }
     $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $configfile . '.master', "tpl/{$configfile}.master");
     $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
     $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
     $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
     $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
     $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
     $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
     $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
     $content = str_replace('{server_id}', $conf['server_id'], $content);
     $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
     $content = str_replace('{language}', $conf['language'], $content);
     $content = str_replace('{timezone}', $conf['timezone'], $content);
     $content = str_replace('{theme}', $conf['theme'], $content);
     $content = str_replace('{language_file_import_enabled}', $conf['language_file_import_enabled'] == true ? 'true' : 'false', $content);
     wf("{$install_dir}/server/lib/{$configfile}", $content);
     //* Create the config file for remote-actions (but only, if it does not exist, because
     //  the value is a autoinc-value and so changed by the remoteaction_core_module
     if (!file_exists($install_dir . '/server/lib/remote_action.inc.php')) {
         $content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
         wf($install_dir . '/server/lib/remote_action.inc.php', $content);
     }
     //* Enable the server modules and plugins.
     // TODO: Implement a selector which modules and plugins shall be enabled.
     $dir = $install_dir . '/server/mods-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/mods-available/' . $file;
                     $module_name = substr($file, 0, -8);
                     $tmp = new $module_name();
                     if ($tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/mods-enabled/' . $file)) {
                             @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-enabled/' . $file);
                         }
                         if (strpos($file, '_core_module') !== false) {
                             if (!@is_link($install_dir . '/server/mods-core/' . $file)) {
                                 @symlink($install_dir . '/server/mods-available/' . $file, $install_dir . '/server/mods-core/' . $file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
         }
     }
     $dir = $install_dir . '/server/plugins-available/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') {
                     continue;
                 }
                 if ($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') {
                     continue;
                 }
                 if ($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
                     include_once $install_dir . '/server/plugins-available/' . $file;
                     $plugin_name = substr($file, 0, -8);
                     $tmp = new $plugin_name();
                     if ($tmp->onInstall()) {
                         if (!@is_link($install_dir . '/server/plugins-enabled/' . $file)) {
                             @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-enabled/' . $file);
                         }
                         if (strpos($file, '_core_plugin') !== false) {
                             if (!@is_link($install_dir . '/server/plugins-core/' . $file)) {
                                 @symlink($install_dir . '/server/plugins-available/' . $file, $install_dir . '/server/plugins-core/' . $file);
                             }
                         }
                     }
                     unset($tmp);
                 }
             }
             closedir($dh);
         }
     }
     // Update the server config
     $mail_server_enabled = $conf['services']['mail'] ? 1 : 0;
     $web_server_enabled = $conf['services']['web'] ? 1 : 0;
     $dns_server_enabled = $conf['services']['dns'] ? 1 : 0;
     $file_server_enabled = $conf['services']['file'] ? 1 : 0;
     $db_server_enabled = $conf['services']['db'] ? 1 : 0;
     $vserver_server_enabled = $conf['services']['vserver'] ? 1 : 0;
     $sql = "UPDATE `server` SET mail_server = '{$mail_server_enabled}', web_server = '{$web_server_enabled}', dns_server = '{$dns_server_enabled}', file_server = '{$file_server_enabled}', db_server = '{$db_server_enabled}', vserver_server = '{$vserver_server_enabled}' WHERE server_id = " . intval($conf['server_id']);
     if ($conf['mysql']['master_slave_setup'] == 'y') {
         $this->dbmaster->query($sql);
         $this->db->query($sql);
     } else {
         $this->db->query($sql);
     }
     // chown install dir to root and chmod 755
     $command = 'chown root:root ' . $install_dir;
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     $command = 'chmod 755 ' . $install_dir;
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Chmod the files and directories in the install dir
     $command = 'chmod -R 750 ' . $install_dir . '/*';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* chown the interface files to the ispconfig user and group
     $command = 'chown -R ispconfig:ispconfig ' . $install_dir . '/interface';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* chown the server files to the root user and group
     $command = 'chown -R root:root ' . $install_dir . '/server';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* chown the security files to the root user and group
     $command = 'chown -R root:root ' . $install_dir . '/security';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* chown the security directory and security_settings.ini to root:ispconfig
     $command = 'chown root:ispconfig ' . $install_dir . '/security/security_settings.ini';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     $command = 'chown root:ispconfig ' . $install_dir . '/security';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     $command = 'chown root:ispconfig ' . $install_dir . '/security/ids.whitelist';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     $command = 'chown root:ispconfig ' . $install_dir . '/security/ids.htmlfield';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     $command = 'chown root:ispconfig ' . $install_dir . '/security/apache_directives.blacklist';
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     //* Make the global language file directory group writable
     exec("chmod -R 770 {$install_dir}/interface/lib/lang");
     //* Make the temp directory for language file exports writable
     exec("chmod -R 770 {$install_dir}/interface/web/temp");
     //* Make all interface language file directories group writable
     $handle = @opendir($install_dir . '/interface/web');
     while ($file = @readdir($handle)) {
         if ($file != '.' && $file != '..') {
             if (@is_dir($install_dir . '/interface/web' . '/' . $file . '/lib/lang')) {
                 $handle2 = opendir($install_dir . '/interface/web' . '/' . $file . '/lib/lang');
                 chmod($install_dir . '/interface/web' . '/' . $file . '/lib/lang', 0770);
                 while ($lang_file = @readdir($handle2)) {
                     if ($lang_file != '.' && $lang_file != '..') {
                         chmod($install_dir . '/interface/web' . '/' . $file . '/lib/lang/' . $lang_file, 0770);
                     }
                 }
             }
         }
     }
     //* Make the APS directories group writable
     exec("chmod -R 770 {$install_dir}/interface/web/sites/aps_meta_packages");
     exec("chmod -R 770 {$install_dir}/server/aps_packages");
     //* make sure that the server config file (not the interface one) is only readable by the root user
     chmod($install_dir . '/server/lib/config.inc.php', 0600);
     chown($install_dir . '/server/lib/config.inc.php', 'root');
     chgrp($install_dir . '/server/lib/config.inc.php', 'root');
     //* Make sure thet the interface config file is readable by user ispconfig only
     chmod($install_dir . '/interface/lib/config.inc.php', 0600);
     chown($install_dir . '/interface/lib/config.inc.php', 'ispconfig');
     chgrp($install_dir . '/interface/lib/config.inc.php', 'ispconfig');
     if (@is_file("{$install_dir}/server/lib/mysql_clientdb.conf")) {
         exec("chmod 600 {$install_dir}/server/lib/mysql_clientdb.conf");
         exec("chown root:root {$install_dir}/server/lib/mysql_clientdb.conf");
     }
     if (is_dir($install_dir . '/interface/invoices')) {
         exec('chmod -R 770 ' . escapeshellarg($install_dir . '/interface/invoices'));
         exec('chown -R ispconfig:ispconfig ' . escapeshellarg($install_dir . '/interface/invoices'));
     }
     exec('chown -R root:root /usr/local/ispconfig/interface/ssl');
     // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
     // and must be fixed as this will allow the apache user to read the ispconfig files.
     // Later this must run as own apache server or via suexec!
     if ($conf['apache']['installed'] == true) {
         $command = 'usermod -a -G ispconfig ' . $conf['apache']['user'];
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         if (is_group('ispapps')) {
             $command = 'usermod -a -G ispapps ' . $conf['apache']['user'];
             caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         }
     }
     if ($conf['nginx']['installed'] == true) {
         $command = 'usermod -a -G ispconfig ' . $conf['nginx']['user'];
         caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         //if(is_user('ispapps')){
         // Allow the ispapps vhost access to /etc/squirrelmail
         //$command = 'usermod -a -G '.$conf['apache']['group'].' ispapps';
         //caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
         //}
         if (is_group('ispapps')) {
             $command = 'usermod -a -G ispapps ' . $conf['nginx']['user'];
             caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
         }
     }
     //* Make the shell scripts executable
     $command = "chmod +x {$install_dir}/server/scripts/*.sh";
     caselog($command . ' &> /dev/null', __FILE__, __LINE__, "EXECUTED: {$command}", "Failed to execute the command {$command}");
     if ($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true) {
         //* Copy the ISPConfig vhost for the controlpanel
         // TODO: These are missing! should they be "vhost_dist_*_dir" ?
         $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
         $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
         // Dont just copy over the virtualhost template but add some custom settings
         $tpl = new tpl('apache_ispconfig.vhost.master');
         $tpl->setVar('vhost_port', $conf['apache']['vhost_port']);
         // comment out the listen directive if port is 80 or 8443
         if ($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 8443) {
             $tpl->setVar('vhost_port_listen', '#');
         } else {
             $tpl->setVar('vhost_port_listen', '');
         }
         if (is_file($install_dir . '/interface/ssl/ispserver.crt') && is_file($install_dir . '/interface/ssl/ispserver.key')) {
             $tpl->setVar('ssl_comment', '');
         } else {
             $tpl->setVar('ssl_comment', '#');
         }
         if (is_file($install_dir . '/interface/ssl/ispserver.crt') && is_file($install_dir . '/interface/ssl/ispserver.key') && is_file($install_dir . '/interface/ssl/ispserver.bundle')) {
             $tpl->setVar('ssl_bundle_comment', '');
         } else {
             $tpl->setVar('ssl_bundle_comment', '#');
         }
         $tpl->setVar('apache_version', getapacheversion());
         wf($vhost_conf_dir . '/ispconfig.vhost', $tpl->grab());
         //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
         //* and create the symlink
         //if($this->is_update == false) {
         if (@is_link("{$vhost_conf_enabled_dir}/ispconfig.vhost")) {
             unlink("{$vhost_conf_enabled_dir}/ispconfig.vhost");
         }
         if (!@is_link("{$vhost_conf_enabled_dir}/000-ispconfig.vhost")) {
             exec("ln -s {$vhost_conf_dir}/ispconfig.vhost {$vhost_conf_enabled_dir}/000-ispconfig.vhost");
         }
         /*
         exec('mkdir -p /home/www/php-fcgi-scripts/ispconfig');
         exec('cp tpl/apache_ispconfig_fcgi_starter.master /home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
         exec('chmod +x /home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
         exec('ln -s /usr/local/ispconfig/interface/web /home/www/ispconfig');
         exec('chown -R ispconfig:ispconfig /home/www/php-fcgi-scripts/ispconfig');
         
         replaceLine('/home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
         */
         //if(!is_file('/home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
         $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
         $content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
         $content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
         if (!is_dir('/home/www/php-fcgi-scripts/ispconfig')) {
             exec('mkdir -p /home/www/php-fcgi-scripts/ispconfig');
         }
         wf('/home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
         exec('chmod +x /home/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
         if (!is_link('/home/www/ispconfig')) {
             exec('ln -s /usr/local/ispconfig/interface/web /home/www/ispconfig');
         }
         exec('chown -R ispconfig:ispconfig /home/www/php-fcgi-scripts/ispconfig');
         //}
         //}
     }
     if ($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true) {
         //* Copy the ISPConfig vhost for the controlpanel
         $vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
         $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
         // Dont just copy over the virtualhost template but add some custom settings
         $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
         $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
         if (is_file($install_dir . '/interface/ssl/ispserver.crt') && is_file($install_dir . '/interface/ssl/ispserver.key')) {
             $content = str_replace('{ssl_on}', ' on', $content);
             $content = str_replace('{ssl_comment}', '', $content);
             $content = str_replace('{fastcgi_ssl}', 'on', $content);
         } else {
             $content = str_replace('{ssl_on}', ' off', $content);
             $content = str_replace('{ssl_comment}', '#', $content);
             $content = str_replace('{fastcgi_ssl}', 'off', $content);
         }
         $socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
         if (substr($socket_dir, -1) != '/') {
             $socket_dir .= '/';
         }
         if (!is_dir($socket_dir)) {
             exec('mkdir -p ' . $socket_dir);
         }
         $fpm_socket = $socket_dir . 'ispconfig.sock';
         //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
         $content = str_replace('{fpm_socket}', $fpm_socket, $content);
         wf($vhost_conf_dir . '/ispconfig.vhost', $content);
         unset($content);
         // PHP-FPM
         // Dont just copy over the php-fpm pool template but add some custom settings
         $content = rfsel($conf['ispconfig_install_dir'] . '/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
         $content = str_replace('{fpm_pool}', 'ispconfig', $content);
         //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
         $content = str_replace('{fpm_socket}', $fpm_socket, $content);
         $content = str_replace('{fpm_user}', 'ispconfig', $content);
         $content = str_replace('{fpm_group}', 'ispconfig', $content);
         wf($conf['nginx']['php_fpm_pool_dir'] . '/ispconfig.conf', $content);
         //copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost');
         //* and create the symlink
         if ($this->is_update == false) {
             if (@is_link($vhost_conf_enabled_dir . '/ispconfig.vhost')) {
                 unlink($vhost_conf_enabled_dir . '/ispconfig.vhost');
             }
             if (!@is_link($vhost_conf_enabled_dir . '/000-ispconfig.vhost')) {
                 symlink($vhost_conf_dir . '/ispconfig.vhost', $vhost_conf_enabled_dir . '/000-ispconfig.vhost');
             }
         }
         // create symlink from /usr/share/phpmyadmin to /usr/share/phpMyAdmin, if it is installed
         if (!@file_exists('/usr/share/phpmyadmin') && @is_dir('/usr/share/phpMyAdmin')) {
             symlink('/usr/share/phpMyAdmin/', '/usr/share/phpmyadmin');
         }
     }
     // Make the Clamav log files readable by ISPConfig
     //exec('chmod +r /var/log/clamav/clamav.log');
     //exec('chmod +r /var/log/clamav/freshclam.log');
     //* Install the update script
     if (is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) {
         unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
     }
     exec('chown root /usr/local/ispconfig/server/scripts/update_from_dev.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_dev.sh');
     exec('chown root /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
     exec('chown root /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
     exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
     if (!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) {
         exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_dev.sh');
     }
     if (!is_link('/usr/local/bin/ispconfig_update.sh')) {
         exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
     }
     // set the fast cgi starter script to executable
     // exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
     //* Make the logs readable for the ispconfig user
     if (@is_file('/var/log/maillog')) {
         exec('chmod +r /var/log/maillog');
     }
     //if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
     //if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
     if (@is_file('/var/log/messages')) {
         exec('chmod +r /var/log/messages');
     }
     //To enable apache to read the directories
     // exec('chmod a+rx /usr/local/ispconfig');
     // exec('chmod -R 751 /usr/local/ispconfig/interface');
     // exec('chmod a+rx /usr/local/ispconfig/interface/web');
     //* Create the ispconfig log directory
     if (!is_dir($conf['ispconfig_log_dir'])) {
         mkdir($conf['ispconfig_log_dir']);
     }
     if (!is_file($conf['ispconfig_log_dir'] . '/ispconfig.log')) {
         exec('touch ' . $conf['ispconfig_log_dir'] . '/ispconfig.log');
     }
     if (is_user('getmail')) {
         exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
         exec('chown getmail /usr/local/bin/run-getmail.sh');
         exec('chmod 744 /usr/local/bin/run-getmail.sh');
     }
     // Edit the file Edit the file /etc/sudoers and comment out the requiregetty line, otherwise the backup function will fail
     replaceLine('/etc/sudoers', 'Defaults    requiretty', '#Defaults    requiretty', 0, 0);
     if (is_dir($install_dir . '/interface/invoices')) {
         exec('chmod -R 770 ' . escapeshellarg($install_dir . '/interface/invoices'));
         exec('chown -R ispconfig:ispconfig ' . escapeshellarg($install_dir . '/interface/invoices'));
     }
     //* Create the ispconfig auth log file and set uid/gid
     if (!is_file($conf['ispconfig_log_dir'] . '/auth.log')) {
         touch($conf['ispconfig_log_dir'] . '/auth.log');
     }
     exec('chown ispconfig:ispconfig ' . $conf['ispconfig_log_dir'] . '/auth.log');
     exec('chmod 660 ' . $conf['ispconfig_log_dir'] . '/auth.log');
     //* Remove Domain module as its functions are available in the client module now
     if (@is_dir('/usr/local/ispconfig/interface/web/domain')) {
         exec('rm -rf /usr/local/ispconfig/interface/web/domain');
     }
     // Add symlink for patch tool
     if (!is_link('/usr/local/bin/ispconfig_patch')) {
         exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_patch /usr/local/bin/ispconfig_patch');
     }
     // Change mode of a few files from amavisd
     if (is_file($conf['amavis']['config_dir'] . '/conf.d/50-user')) {
         chmod($conf['amavis']['config_dir'] . '/conf.d/50-user', 0640);
     }
     if (is_file($conf['amavis']['config_dir'] . '/50-user~')) {
         chmod($conf['amavis']['config_dir'] . '/50-user~', 0400);
     }
     if (is_file($conf['amavis']['config_dir'] . '/amavisd.conf')) {
         chmod($conf['amavis']['config_dir'] . '/amavisd.conf', 0640);
     }
     if (is_file($conf['amavis']['config_dir'] . '/amavisd.conf~')) {
         chmod($conf['amavis']['config_dir'] . '/amavisd.conf~', 0400);
     }
 }
function cjView($strlink, $num)
{
    global $starringarr, $titlearr, $picarr, $strListUrl, $p_playspecialtype, $p_playtype, $p_videocodeType, $p_videocodeApiUrl, $p_id, $p_videocodeApiUrlParamstart, $p_videocodeApiUrlParamend, $p_videourlstart, $p_videourlend, $playcodeApiUrl, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend, $playcodeApiUrltype, $db, $strListUrl, $p_titletype, $starringarr, $titlearr, $picarr, $p_id, $p_titlestart, $p_titleend, $p_lzstart, $p_lzend, $p_hitsstart, $p_hitsend, $p_starringtype, $p_starringstart, $p_starringend, $p_picstart, $p_picend, $p_typestart, $p_typeend, $p_pictype, $p_classtype, $p_collect_type, $p_timestart, $p_timeend, $p_areastart, $p_areaend, $p_contentstart, $p_contentend, $p_playcodestart, $p_playcodeend, $p_playlinkstart, $p_playlinkend, $p_playurlstart, $p_playurlend, $p_playcodetype, $p_playlinktype, $p_playtype, $p_coding, $p_lzstart, $p_lzend, $p_lzcodetype, $p_lzcodestart, $p_lzcodeend, $p_languagestart, $p_languageend, $p_remarksstart, $p_remarksend, $p_script, $p_showtype, $p_savefiles, $strdstate, $p_server, $p_setnametype, $p_setnamestart, $p_setnameend, $p_directedstart, $p_directedend, $cache;
    $androidUrl = "";
    //var_dump($strlink);var_dump($strListUrl);
    try {
        $pos = strpos($strlink, "href=\"");
        if ($pos !== false) {
            $strlink = substr($strlink, $pos + 6);
        }
        $pos = strpos($strlink, "\"");
        if ($pos !== false) {
            $strlink = substr($strlink, 0, $pos);
        }
    } catch (Exception $e) {
    }
    $strlink = definiteUrl($strlink, $strListUrl);
    writetofile("crawel_auto_info.log", $p_id . '{=====}' . $strlink . "{=====}View===start");
    $strViewCode = getPage($strlink, $p_coding);
    if ($strViewCode == false) {
        $strdstate = "true";
        writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl);
        $sb = $sb + 1;
        return;
    } else {
        //节目名称,来自列表或者来自内容页
        if ($p_titletype == 1) {
            $titlecode = $titlearr[$num];
        } else {
            $titlecode = getBody($strViewCode, $p_titlestart, $p_titleend);
        }
        //		var_dump($titlearr[$num]);
        $titlecode = filterScript($titlecode, $p_script);
        $titlecode = replaceFilters($titlecode, $p_id, 1, 0);
        $titlecode = replaceStr(replaceStr(replaceStr($titlecode, ",", " "), "'", ""), "\"\"", "");
        $titlecode = trim($titlecode);
        //		$sql="select count(*) as cc from {pre}cj_vod where m_name='".$titlecode."' and m_playfrom='".$p_playtype."'";
        //		$row=$db->getOne($sql);
        //		//var_dump($row);var_dump($titlecode);
        //		$rowcount = $row;
        //先缩小范围
        if ($p_lzcodetype == 1) {
            //连载范围
            $lzfwcode = getBody($strViewCode, $p_lzcodestart, $p_lzcodeend);
            //连载编码
            $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend);
            $lzcode = replaceStr($lzcode, "false", "0");
            $lzcode = trim($lzcode);
            $lzcode = intval($lzcode);
        } else {
            $lzcode = getBody($strViewCode, $p_lzstart, $p_lzend);
            $lzcode = replaceStr($lzcode, "false", "0");
            $lzcode = trim($lzcode);
            $lzcode = intval($lzcode);
        }
        //		if ($p_playcodetype !=2 &&($lzcode == 0) && ($rowcount>0)) {
        //			$strdstate = "true";
        //			echo "<tr><td colspan=\"2\">遇到重复电影数据跳过采集!</TD></TR>";
        //			return;
        //		}
        if (isN($p_hitsstart) || !isnum($p_hitsstart)) {
            $p_hitsstart = 0;
        }
        if (isN($p_hitsend) || !isnum($p_hitsend)) {
            $p_hitsend = 0;
        }
        if ($p_hitsstart == 0 && $p_hitsend == 0) {
            $m_hits = 0;
        } else {
            $m_hits = rand($p_hitsend, $p_hitsstart);
        }
        if ($p_starringtype == 1) {
            $starringcode = $starringarr[$num];
        } else {
            $starringcode = getBody($strViewCode, $p_starringstart, $p_starringend);
        }
        //演员
        $starringcode = filterScriptStar($starringcode, $p_script);
        $starringcode = replaceStr(replaceStr(replaceStr($starringcode, ",", " "), "'", ""), "\"\"", "");
        $starringcode = trim($starringcode);
        if ($p_pictype == 1) {
            $piccode = $picarr[$num];
        } else {
            $piccode = getBody($strViewCode, $p_picstart, $p_picend);
        }
        //图片
        $piccode = trim($piccode);
        $piccode = getHrefFromImg(definiteUrl($piccode, $strListUrl));
        //栏目设置
        if ($p_classtype == 1) {
            $typecode = filterScript(getBody($strViewCode, $p_typestart, $p_typeend), $p_script);
            $typecode = trim($typecode);
            $m_typeid = changeId($typecode, $p_id, 0, 0);
        } else {
            $typecode = $p_collect_type;
            $typecode = trim($typecode);
            $m_typeid = $p_collect_type;
            $typearr = getValueByArray($cache[0], "t_id", $typecode);
            $typecode = $typearr["t_name"];
        }
        if ($m_typeid == 0) {
            $m_typeid = $p_collect_type;
        }
        $typecode = filterScript($typecode, $p_script);
        //导演
        $directedcode = filterScriptStar(getBody($strViewCode, $p_directedstart, $p_directedend), $p_script);
        $directedcode = replaceStr($directedcode, "false", "");
        $directedcode = replaceStr($directedcode, "'", "");
        $directedcode = trim($directedcode);
        //备注
        $remarkscode = filterScript(getBody($strViewCode, $p_remarksstart, $p_remarksend), $p_script);
        $remarkscode = replaceStr($remarkscode, "false", "");
        $remarkscode = trim($remarkscode);
        //语音
        $languagecode = filterScript(getBody($strViewCode, $p_languagestart, $p_languageend), $p_script);
        $languagecode = replaceStr($languagecode, "false", "未知");
        $languagecode = trim($languagecode);
        //时间
        $timecode = filterScript(getBody($strViewCode, $p_timestart, $p_timeend), $p_script);
        if ($timecode == false) {
            $timecode == "未知";
        }
        $timecode = trim($timecode);
        //地区
        $areacode = filterScript(getBody($strViewCode, $p_areastart, $p_areaend), $p_script);
        if ($areacode == false) {
            $areacode = "未知";
        }
        $areacode = trim($areacode);
        //内容
        $contentcode = filterScript(getBody($strViewCode, $p_contentstart, $p_contentend), $p_script);
        if ($contentcode == false) {
            $contentcode = "未知";
        }
        $contentcode = filterScript(replaceFilters($contentcode, $p_id, 2, 0), $p_script);
        $contentcode = replaceStr(replaceStr(replaceStr($contentcode, ",", " "), "'", ""), "\"\"", "");
        $contentcode = trim($contentcode);
        $m_area = $areacode;
        $m_languageid = $languagecode;
        //播放列表,缩小
        if ($p_playcodetype == 1) {
            $playcode = getBody($strViewCode, $p_playcodestart, $p_playcodeend);
            //获取地址设置
            if ($p_playlinktype > 0) {
                //播放链接
                $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend);
            } else {
                //内容页直接获取地址, 地址开始
                $weburl = getArray($playcode, $p_playurlstart, $p_playurlend);
            }
            if ($p_setnametype == 3) {
                $setnames = getArray($playcode, $p_setnamestart, $p_setnameend);
            }
        } else {
            if ($p_playcodetype == 2) {
                //from api
                //		writetofile("d:\\s.txt",$linkcode) ;
                //		echo $p_playcodeApiUrlParamend .'=='.$playcodeApiUrlParamstart;
                //		echo $playcodeApiUrlParamstart .'\n' .$p_playcodeApiUrlParamend .'  = '.$playcodeApiUrltype;
                if ($playcodeApiUrltype == 0) {
                    $paracode = getBody($strViewCode, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend);
                } else {
                    $paracode = getBody($UrlTestMoive, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend);
                }
                //		echo $paracode;
                $p_apibatchurl = replaceStr($playcodeApiUrl, "{PROD_ID}", $paracode);
                $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", 1);
                $playcode = getFormatPage($p_apibatchurls, $p_coding);
                $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend);
                $page_num = 2;
                //		echo "page 1 :".$weburl .'\n';
                $flag = true;
                while ($flag && $page_num < 15 && strpos($playcodeApiUrl, "{PAGE_NO}") !== false) {
                    $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", $page_num);
                    //			echo $p_apibatchurls .'\n';
                    $playcode = getFormatPage($p_apibatchurls, $p_coding);
                    $weburls = getArray($playcode, $p_playlinkstart, $p_playlinkend);
                    //		    echo "page ".$page_num." :".$weburls .'\n';
                    if ($weburls) {
                        $weburl = $weburl . "{Array}" . $weburls;
                        $page_num = $page_num + 1;
                    } else {
                        $flag = false;
                    }
                }
                //		var_dump($weburl);
                //		if ($p_playlinktype >0) {
                //			$weburl = getArray($playcode,$p_playlinkstart,$p_playlinkend);
                //		}
                //		else{
                //			$weburl = getArray($playcode,$p_playurlstart,$p_playurlend);
                //		//	var_dump($playcode);
                //		}
                //		if ($p_setnametype == 3) {
                //			$setnames = getArray($playcode,$p_setnamestart,$p_setnameend);
                //		}
            } else {
                if ($p_playlinktype > 0) {
                    $weburl = getArray($strViewCode, $p_playlinkstart, $p_playlinkend);
                    //				var_dump($weburl);
                } else {
                    $weburl = getArray($strViewCode, $p_playurlstart, $p_playurlend);
                    $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($strViewCode, $p_coding, $p_script);
                    $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($strViewCode, $p_coding, $p_script);
                    writetofile("android_log.txt", $strlink . '{===}' . $androidUrl . '{===}' . $videoAddressUrl);
                }
                if ($p_setnametype == 3) {
                    $setnames = getArray($strViewCode, $p_setnamestart, $p_setnameend);
                }
            }
        }
        if ($p_showtype == 1) {
            if ($p_savefiles == 1) {
                $filename = time() . $num;
                if (strpos($piccode, ".jpg") || strpos($piccode, ".bmp") || strpos($piccode, ".png") || strpos($piccode, ".gif")) {
                    $extName = substring($piccode, 4, strlen($piccode) - 4);
                } else {
                    $extName = ".jpg";
                }
                $picpath = "upload/vod/" . getSavePicPath() . "/";
                $picfile = $filename . $extName;
                //echo "<tr><td width=\"20%\" >自动下载图片:</td><td><iframe border=\"0\" valign=\"bottom\" vspace=\"0\" hspace=\"0\" marginwidth=\"0\" marginheight=\"0\" framespacing=\"0\" frameborder=\"0\" scrolling=\"no\" width=\"400\" height=\"15\" src=\"../admin_pic.php?action=downpic&wjs=1&path=../".$picpath."&file=".$picfile."&url=".$piccode."\"></iframe></td></tr>";
                $piccode = $picpath . $picfile;
            }
        } else {
            //		echo "<tr><td colspan=\"2\" align=\"center\">第".($num+1)."条数据采集结果</td></tr><tr><td width=\"20%\" >来源:</td><td >".$strlink."</td></tr><tr><td width=\"20%\" >名称:</td><td >".$titlecode." 连载:".$lzcode." 备注:".$remarkscode."</td></tr>";
        }
        if ($weburl == false) {
            //			echo "<tr><td colspan=\"2\">在获取播放列表链接时出错 ".$strlink." / '.$strListUrl.'</TD></TR>";
            writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strlink . '{=====}' . $strListUrl);
            //			$sb=$sb+1;
            return;
        } else {
            $sql = "select m_id,m_name,m_type,m_area,m_playfrom,m_starring,m_directed,m_pic,m_content,m_year,m_addtime,m_urltest,m_zt,m_pid,m_typeid,m_hits,m_playserver,m_state from {pre}cj_vod where  m_pid='" . $p_id . "' and m_name='" . $titlecode . "'  order by m_id desc";
            $rowvod = $db->getRow($sql);
            if ($rowvod) {
                $cg = $cg + 1;
                $movieid = $rowvod["m_id"];
                if (isN($titlecode)) {
                    $titlecode = $rowvod["m_name"];
                }
                if (isN($starringcode)) {
                    $starringcode = $rowvod["m_starring"];
                }
                if (isN($piccode)) {
                    $piccode = $rowvod["m_pic"];
                }
                $sql = "update {pre}cj_vod set m_pic='" . $piccode . "', m_type='" . $typecode . "',m_area='" . $areacode . "',m_urltest='" . $strlink . "',m_name='" . $titlecode . "',m_starring='" . $starringcode . "',m_directed='" . $directedcode . "',m_year='" . $timecode . "',m_playfrom='" . $p_playtype . "',m_content='" . $contentcode . "',m_addtime='" . date('Y-m-d H:i:s', time()) . "',m_zt='0',m_pid='" . $p_id . "',m_typeid='" . $m_typeid . "',m_playserver='" . $p_server . "',m_state='" . $lzcode . "',m_language='" . $languagecode . "',m_remarks='" . $remarkscode . "' where m_id=" . $rowvod["m_id"];
                writetofile("sql.txt", $sql);
                $db->query($sql);
                //			$sql="delete from {pre}cj_vod_url where u_movieid=".$rowvod["m_id"];
                //			writetofile("sql.txt", $sql);
                //			$db->query($sql);
            } else {
                $cg = $cg + 1;
                $sql = "insert {pre}cj_vod (m_name,m_type,m_area,m_playfrom,m_starring,m_directed,m_pic,m_content,m_year,m_urltest,m_zt,m_pid,m_typeid,m_hits,m_playserver,m_state,m_addtime,m_language,m_remarks) values('" . $titlecode . "','" . $typecode . "','" . $areacode . "','" . $p_playtype . "','" . $starringcode . "','" . $directedcode . "','" . $piccode . "','" . $contentcode . "','" . $timecode . "','" . $strlink . "','0','" . $p_id . "','" . $m_typeid . "','" . $m_hits . "','" . $p_server . "','" . $lzcode . "','" . date('Y-m-d H:i:s', time()) . "','" . $languagecode . "','" . $remarkscode . "')";
                writetofile("sql.txt", $sql);
                $db->query($sql);
                $movieid = $db->insert_id();
            }
            $webArray = explode("{Array}", $weburl);
            $setnamesArray = explode("{Array}", $setnames);
            $webArraTemp = array();
            $index = 0;
            $webUrls = '';
            for ($i = 0; $i < count($webArray); $i++) {
                $UrlTemp = $webArray[$i];
                if (strpos($webUrls, $UrlTemp . '<array>') === false) {
                    $webArraTemp[$index] = $UrlTemp;
                    $webUrls = $webUrls . $UrlTemp . '<array>';
                    $index++;
                }
            }
            //	    writetofile("d:\\ssssss.txt","p_videocodeType:".$p_videocodeType);
            $webArray = $webArraTemp;
            //http://www.youku.com/show_episode/id_zc16d0492e81411e196ac.html?dt=json&divid=reload_1&__rt=1&__ro=reload_1
            for ($i = 0; $i < count($webArray); $i++) {
                $WebTestx = $webArray[$i];
                if ($p_playspecialtype == 1 && strpos("," . $p_playspecialrrul, "[变量]")) {
                    $Keyurl = explode("[变量]", $p_playspecialrrul);
                    $urli = getBody($UrlTest, $Keyurl[0], $Keyurl[1]);
                    if ($urli == false) {
                        break;
                    }
                    $WebTestx = replaceStr($p_playspecialrerul, "[变量]", $urli);
                }
                if ($p_playspecialtype == 2) {
                    $urArray = explode("/", $strlink);
                    $ur = "";
                    for ($k = 0; $k < count($urArray) - 1; $k++) {
                        $ur = $ur . $urArray[$k] . "/";
                    }
                    $WebTestx = $ur . $WebTestx . ".html";
                }
                writetofile("crawel_auto_info.log", $p_id . '{=====}' . $WebTestx . "{=====}ViewList===start");
                if ($p_playlinktype == 1) {
                    //播放页获取地址
                    $WebTestx = getHrefFromLink($WebTestx);
                    $WebTestx = definiteUrl($WebTestx, $strListUrl);
                    $playCode = getPage($WebTestx, $p_coding);
                    $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($playCode, $p_coding, $p_script);
                    $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($playCode, $p_coding, $p_script);
                    writetofile("android_log.txt", $strlink . '{===}' . $androidUrl . '{===}' . $videoAddressUrl);
                    $url = getBody($playCode, $p_playurlstart, $p_playurlend);
                    $url = replaceLine($url);
                } else {
                    if ($p_playlinktype == 2) {
                        //播放链接中获取地址
                        $WebTestx = getHrefFromLink($WebTestx);
                        if (isN($p_playurlend)) {
                            $tmpA = strpos($WebTestx, $p_playurlstart);
                            $url = substr($WebTestx, strlen($WebTestx) - $tmpA - strlen($p_playurlstart) + 1);
                        } else {
                            $url = getBody($WebTestx, $p_playurlstart, $p_playurlend);
                        }
                    } else {
                        if ($p_playlinktype == 3) {
                            //单播放页获取所有播放地址
                            $WebTestx = getHrefFromLink($WebTestx);
                            $playCode = getPage($WebTestx, $p_coding);
                            $tmpB = getArray($webCode, $p_playurlstart, $p_playurlend);
                            $tmpC = explode("{$Array}\$", $tmpB);
                            foreach ($tmpC as $tmpD) {
                                $sql = "SELECT {pre}vod_url.u_url FROM ({pre}vod_url INNER JOIN {pre}vod ON {pre}vod_url.u_movieid = {pre}vod.m_id)  where {pre}vod_url.u_url='" . $tmpD . "' and {pre}vod.m_pid=" . $p_id;
                                $row = $db->getRow($sql);
                                if (!$row) {
                                    $strTempUrl = $strTempUrl . $tmpD . "<br>";
                                    $db->query("insert into {pre}vod_url(u_url,u_movieid) values('" . $tmpD . "','" . $movieid . "')");
                                }
                            }
                            break;
                        } else {
                            $url = $WebTestx;
                            $url = replaceLine($url);
                        }
                    }
                }
                $url = replaceFilters($url, $p_id, 3, 0);
                if ($p_setnametype == 1) {
                    $setname = getBody($url, $p_setnamestart, $p_setnameend);
                    //					$url = $setname . "$" . $url;
                } else {
                    if ($p_setnametype == 2 && $p_playlinktype == 1) {
                        $setname = getBody($playCode, $p_setnamestart, $p_setnameend);
                        //					$url = $setname ."$" .$url;
                    } else {
                        if ($p_setnametype == 3) {
                            $setname = $setnamesArray[$i];
                        }
                    }
                }
                $sql = "SELECT {pre}cj_vod_url.u_url FROM ({pre}cj_vod_url INNER JOIN {pre}cj_vod ON {pre}cj_vod_url.u_movieid = {pre}cj_vod.m_id)  where {pre}cj_vod_url.u_url='" . $url . "' and {pre}cj_vod.m_pid=" . $p_id . " and {pre}cj_vod.m_id=" . $movieid;
                $rowurl = $db->getRow($sql);
                //     		   writetofile("d:\\sql.txt",$rowurl);
                if (!$rowurl) {
                    if ($p_playlinktype == 1) {
                        $strTempUrl .= $url . "<br>";
                        $url = replaceStr($url, "'", "''");
                        writetofile("sql.txt", "insert into {pre}cj_vod_url(u_url,u_movieid,u_weburl,iso_video_url,name,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($WebTestx) . "','" . getHrefFromLink($videoAddressUrl) . "','" . filterScriptStar($setname, $p_script) . "' ,'" . $androidUrl . "' )");
                        $db->query("insert into {pre}cj_vod_url(u_url,u_movieid,u_weburl,iso_video_url,name,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($WebTestx) . "','" . getHrefFromLink($videoAddressUrl) . "','" . filterScriptStar($setname, $p_script) . "' ,'" . $androidUrl . "' )");
                    } else {
                        $strTempUrl .= $url . "<br>";
                        writetofile("sql.txt", "insert into {pre}cj_vod_url(u_url,u_movieid,iso_video_url,u_weburl,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($videoAddressUrl) . "','" . getHrefFromLink($strlink) . "', '" . $androidUrl . "')");
                        $db->query("insert into {pre}cj_vod_url(u_url,u_movieid,iso_video_url,u_weburl,android_vedio_url) values('" . $url . "','" . $movieid . "','" . getHrefFromLink($videoAddressUrl) . "','" . getHrefFromLink($strlink) . "', '" . $androidUrl . "')");
                    }
                }
            }
        }
    }
    $cg = $cg + 1;
}
Ejemplo n.º 23
0
    }
    if (!empty($error)) {
        $score = $DataReview[5];
    }
    @($comments = !get_magic_quotes_gpc() ? $comments : stripslashes($comments));
    $comments = preg_replace("/<[^>]*>/", "", $comments);
    $comments = trim($comments);
    $comments = mynl2br($comments, '<br>');
    $comments = preg_replace('/\\s\\s+/', ' ', $comments);
    $comments = substr($comments, 0, 550);
    $data = $sku . '|' . $item_id . '|' . $dd . '|' . $email . '|' . $name . '|' . $rate . '|' . $approve . '|spare|' . $comments . '|';
    if (empty($error) && $_POST['status'] == 'new') {
        $fp = fopen($ReviewFile, "a");
        fwrite($fp, $data . "\n");
        fclose($fp);
        header("location: review.php?mg=new");
        exit;
    }
    if (empty($error) && $_POST['status'] == 'edit') {
        $newdata = $DataReview[0] . '|' . $DataReview[1] . '|' . $DataReview[2] . '|' . $DataReview[3] . '|' . $name . '|' . $rate . '|' . $approve . '|spare|' . $comments . '|';
        replaceLine($ReviewFile, @$DataReview[2], $newdata);
        header("location: review.php?mg=edit");
        exit;
    }
}
$ops = array('+', '*');
$test_human = sprintf('%d %s %d', rand(1, 9), $ops[array_rand($ops)], rand(1, 9));
$meta_title = $title . "-" . $lang['review_title'];
$include = "lib/display_review.php";
$design = $template;
include "templates/" . $design . "/index.php";
Ejemplo n.º 24
0
function lastsave()
{
    global $db, $cache;
    $p_id = be("all", "p_id");
    $p_timestart = be("post", "p_timestart");
    $p_timeend = be("post", "p_timeend");
    $p_areastart = be("post", "p_areastart");
    $p_areaend = be("post", "p_areaend");
    $p_classtype = be("post", "p_classtype");
    $p_collect_type = be("post", "p_collect_type");
    $p_typestart = be("post", "p_typestart");
    $p_typeend = be("post", "p_typeend");
    $p_contentstart = be("post", "p_contentstart");
    $p_contentend = be("post", "p_contentend");
    $p_playcodetype = be("post", "p_playcodetype");
    $p_playcodestart = be("post", "p_playcodestart");
    $p_playcodeend = be("post", "p_playcodeend");
    $p_playurlstart = be("post", "p_playurlstart");
    $p_playurlend = be("post", "p_playurlend");
    $p_playlinktype = be("post", "p_playlinktype");
    $p_playlinkstart = be("post", "p_playlinkstart");
    $p_playlinkend = be("post", "p_playlinkend");
    $p_playspecialtype = be("post", "p_playspecialtype");
    $p_playspecialrrul = be("post", "p_playspecialrrul");
    $p_timestart = be("post", "p_timestart");
    $p_playspecialrerul = be("post", "p_playspecialrerul");
    $p_starringtype = be("post", "p_starringtype");
    $p_starringstart = be("post", "p_starringstart");
    $p_starringend = be("post", "p_starringend");
    $p_titletype = be("post", "p_titletype");
    $p_pictype = be("post", "p_pictype");
    $p_pagetype = be("all", "p_pagetype");
    $p_listcodestart = be("post", "p_listcodestart");
    $p_listcodeend = be("post", "p_listcodeend");
    $p_titlestart = be("post", "p_titlestart");
    $p_titleend = be("post", "p_titleend");
    $p_listlinkstart = be("post", "p_listlinkstart");
    $p_listlinkend = be("post", "p_listlinkend");
    $p_picstart = be("post", "p_picstart");
    $p_picend = be("post", "p_picend");
    $p_lzstart = be("post", "p_lzstart");
    $p_lzend = be("post", "p_lzend");
    $strlisturl = be("post", "listurl");
    $p_coding = be("post", "p_coding");
    $p_lzcodetype = be("post", "p_lzcodetype");
    $p_lzcodestart = be("post", "p_lzcodestart");
    $p_lzcodeend = be("post", "p_lzcodeend");
    $p_languagestart = be("post", "p_languagestart");
    $p_languageend = be("post", "p_languageend");
    $p_remarksstart = be("post", "p_remarksstart");
    $p_remarksend = be("post", "p_remarksend");
    $p_directedstart = be("post", "p_directedstart");
    $p_directedend = be("post", "p_directedend");
    $p_setnametype = be("post", "p_setnametype");
    $p_setnamestart = be("post", "p_setnamestart");
    $p_setnameend = be("post", "p_setnameend");
    $p_setnametype = be("post", "p_setnametype");
    $p_playtype = be("post", "p_playtype");
    //api start
    $playcodeApiUrl = be("post", "p_playcodeApiUrl");
    $playcodeApiUrltype = be("post", "p_playcodeApiUrltype");
    $p_playcodeApiUrlParamend = be("post", "p_playcodeApiUrlParamend");
    $playcodeApiUrlParamstart = be("post", "p_playcodeApiUrlParamstart");
    if (isN($playcodeApiUrltype)) {
        $playcodeApiUrltype = 0;
    }
    $p_videocodeApiUrl = be("post", "p_videocodeApiUrl");
    $p_videocodeApiUrlParamstart = be("post", "p_videocodeApiUrlParamstart");
    $p_videocodeApiUrlParamend = be("post", "p_videocodeApiUrlParamend");
    $p_videourlstart = be("post", "p_videourlstart");
    $p_videourlend = be("post", "p_videourlend");
    $p_videocodeType = be("post", "p_videocodeType");
    //api end
    if (isN($p_videocodeType)) {
        $p_videocodeType = 0;
    }
    if (isN($p_starringtype)) {
        $p_starringtype = 0;
    }
    if (isN($p_titletype)) {
        $p_titletype = 0;
    }
    if (isN($p_pictype)) {
        $p_pictype = 0;
    }
    $sql = "select * from {pre}cj_vod_projects Where p_id=" . $p_id;
    $row = $db->getRow($sql);
    $p_pagetype = $row["p_pagetype"];
    $strSet = "";
    if ($p_pagetype == 3 || $p_starringtype == 0) {
        $strSet .= "p_starringstart='" . $p_starringstart . "',p_starringend='" . $p_starringend . "',";
    } else {
        $p_starringstart = $row["p_starringstart"];
        $p_starringend = $row["p_starringend"];
    }
    if ($p_pagetype == 3 || $p_titletype == 0) {
        $strSet .= "p_titlestart='" . $p_titlestart . "',p_titleend='" . $p_titleend . "',";
    } else {
        $p_titlestart = $row["p_titlestart"];
        $p_titleend = $row["p_titleend"];
    }
    if ($p_pagetype == 3 || $p_pictype == 0) {
        $strSet .= "p_picstart='" . $p_picstart . "',p_picend='" . $p_picend . "',";
    } else {
        $p_picstart = $row["p_picstart"];
        $p_picend = $row["p_picend"];
    }
    $strSet .= "p_lzstart='" . $p_lzstart . "',p_lzend='" . $p_lzend . "',p_timestart='" . $p_timestart . "',p_timeend='" . $p_timeend . "',p_areastart='" . $p_areastart . "',p_areaend='" . $p_areaend . "',p_classtype='" . $p_classtype . "',p_collect_type='" . $p_collect_type . "',p_typestart='" . $p_typestart . "',p_typeend='" . $p_typeend . "',p_contentstart='" . $p_contentstart . "',p_contentend='" . $p_contentend . "',p_playcodetype='" . $p_playcodetype . "',p_playcodestart='" . $p_playcodestart . "',p_playcodeend='" . $p_playcodeend . "',p_playurlstart='" . $p_playurlstart . "',p_playurlend='" . $p_playurlend . "',p_playlinktype='" . $p_playlinktype . "',p_playlinkstart='" . $p_playlinkstart . "',p_playlinkend='" . $p_playlinkend . "',p_playspecialtype='" . $p_playspecialtype . "',p_playspecialrrul='" . $p_playspecialrrul . "',p_playspecialrerul='" . $p_playspecialrerul . "',p_lzcodetype='" . $p_lzcodetype . "',p_lzcodestart='" . $p_lzcodestart . "',p_lzcodeend='" . $p_lzcodeend . "',p_languagestart='" . $p_languagestart . "',p_languageend='" . $p_languageend . "',p_remarksstart='" . $p_remarksstart . "',p_remarksend='" . $p_remarksend . "',p_directedstart='" . $p_directedstart . "',p_directedend='" . $p_directedend . "',p_setnametype='" . $p_setnametype . "',p_setnamestart='" . $p_setnamestart . "',p_setnameend='" . $p_setnameend . "'";
    $strSet = $strSet . ",p_playcodeApiUrl='" . $playcodeApiUrl . "',p_playcodeApiUrltype='" . $playcodeApiUrltype . "',p_playcodeApiUrlParamend='" . $p_playcodeApiUrlParamend . "',p_playcodeApiUrlParamstart='" . $playcodeApiUrlParamstart . "'";
    $strSet = $strSet . ",p_videocodeApiUrl='" . $p_videocodeApiUrl . "',p_videocodeApiUrlParamstart='" . $p_videocodeApiUrlParamstart . "',p_videocodeApiUrlParamend='" . $p_videocodeApiUrlParamend . "',p_videourlstart='" . $p_videourlstart . "',p_videourlend='" . $p_videourlend . "',p_videocodeType='" . $p_videocodeType . "'";
    $db->query("update {pre}cj_vod_projects set " . $strSet . " where p_id=" . $p_id);
    $p_listcodestart = $row["p_listcodestart"];
    $p_listcodeend = $row["p_listcodeend"];
    $p_listlinkstart = $row["p_listlinkstart"];
    $p_listlinkend = $row["p_listlinkend"];
    $p_playcodestart = $row["p_playcodestart"];
    $p_playcodeend = $row["p_playcodeend"];
    $p_pagebatchurl = $row["p_pagebatchurl"];
    $p_pagebatchid1 = $row["p_pagebatchid1"];
    $p_pagebatchid2 = $row["p_pagebatchid2"];
    $p_server = $row["p_server"];
    $UrlTestMoive = '';
    if ($p_server > 0) {
        $p_server_address = $db->getOne("select ds_url from {pre}vod_server where ds_id=" . $p_server);
    }
    $p_script = $row["p_script"];
    //	echo $p_pagetype;
    if ($p_pagetype != 3) {
        if (isN($_SESSION["strListCode"])) {
            $strListCode = getPage($strlisturl, $p_coding);
            $_SESSION["strListCode"] = $strListCode;
        } else {
            $strListCode = $_SESSION["strListCode"];
        }
        if (isN($_SESSION["strListCodeCut"])) {
            $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend);
            $_SESSION["strListCodeCut"] = $strListCodeCut;
        } else {
            $strListCodeCut = $_SESSION["strListCodeCut"];
        }
        if (isN($_SESSION["linkarrcode"])) {
            $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend);
            $_SESSION["linkarrcode"] = $linkarrcode;
        } else {
            $linkarrcode = $_SESSION["linkarrcode"];
        }
        if ($p_starringtype == 1) {
            $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend);
        }
        if ($p_titletype == 1) {
            $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend);
        }
        if ($p_pictype == 1) {
            $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend);
        }
        switch ($linkarrcode) {
            case False:
                errmsg("采集提示", "<li>在获取链接列表时出错。" . $linkarrcode . "</li>");
                break;
            default:
                $linkarr = explode("{Array}", $linkarrcode);
                $UrlTest = getHrefFromLink($linkarr[0]);
                $UrlTest = definiteUrl($UrlTest, $strlisturl);
                //				var_dump($UrlTest);
                $linkcode = getPage($UrlTest, $p_coding);
                $UrlTestMoive = $UrlTest;
                echo "<li>采集提示:采集页面:" . $UrlTest . "</li>";
                break;
        }
    } else {
        $strlisturl = $p_pagebatchurl;
        $p_pagebatchurl = replaceStr($p_pagebatchurl, "{ID}", $p_pagebatchid1);
        $linkcode = getPage($p_pagebatchurl, $p_coding);
    }
    var_dump($p_playtype);
    if ($linkcode == False) {
        errmsg("采集提示", "获取内容页失败!");
        return;
    }
    if ($p_titletype == 1) {
        switch ($titlearrcode) {
            case False:
                $titlecode = "获取失败";
                break;
            default:
                $titlearr = explode("{Array}", $titlearrcode);
                $titlecode = $titlearr[0];
                break;
        }
    } else {
        $titlecode = getBody($linkcode, $p_titlestart, $p_titleend);
        writetofile("tte.log", $linkcode);
        var_dump(ascii_decode($titlecode));
    }
    if ($p_starringtype == 1) {
        switch ($starringarrcode) {
            case False:
                $starringcode = "获取失败";
                break;
            default:
                $starringarr = explode("{Array}", $starringarrcode);
                $starringcode = $starringarr[0];
                break;
        }
    } else {
        $starringcode = getBody($linkcode, $p_starringstart, $p_starringend);
    }
    if ($p_pictype == 1) {
        switch ($picarrcode) {
            case False:
                $piccode = "获取失败";
                break;
            default:
                $picarr = explode("{Array}", $picarrcode);
                $piccode = $picarr[0];
                break;
        }
    } else {
        $piccode = getBody($linkcode, $p_picstart, $p_picend);
    }
    $piccode = definiteUrl($piccode, $strlisturl);
    if ($p_lzcodetype == 1) {
        $lzfwcode = getBody($linkcode, $p_lzcodestart, $p_lzcodeend);
        $lzcode = getBody($lzfwcode, $p_lzstart, $p_lzend);
        $lzcode = replaceStr($lzcode, "False", "0");
    } else {
        $lzcode = getBody($linkcode, $p_lzstart, $p_lzend);
        $lzcode = replaceStr($lzcode, "False", "0");
    }
    $remarkscode = getBody($linkcode, $p_remarksstart, $p_remarksend);
    $remarkscode = replaceStr($remarkscode, "False", "");
    $directedcode = getBody($linkcode, $p_directedstart, $p_directedend);
    $directedcode = replaceStr($directedcode, "False", "");
    $languagecode = getBody($linkcode, $p_languagestart, $p_languageend);
    $languagecode = replaceStr($languagecode, "False", "未知");
    $areacode = getBody($linkcode, $p_areastart, $p_areaend);
    if ($areacode == false) {
        $areacode = "未知";
    }
    $timecode = getBody($linkcode, $p_timestart, $p_timeend);
    if ($timecode == false) {
        $timecode = date('Y-m-d', time());
    }
    $contentcode = getBody($linkcode, $p_contentstart, $p_contentend);
    if ($contentcode == false) {
        $contentcode = "未知";
    }
    $contentcode = replaceFilters($contentcode, $p_id, 2, 0);
    if ($p_classtype == 1) {
        $typecode = getBody($linkcode, $p_typestart, $p_typeend);
    } else {
        $typecode = $p_collect_type;
        $typearr = getValueByArray($cache[0], "t_id", $typecode);
        $typecode = $typearr["t_name"];
    }
    if ($p_playcodetype == 1) {
        $playcode = getBody($linkcode, $p_playcodestart, $p_playcodeend);
        if ($p_playlinktype > 0) {
            $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend);
        } else {
            $weburl = getArray($playcode, $p_playurlstart, $p_playurlend);
            //	var_dump($playcode);
        }
        if ($p_setnametype == 3) {
            $setnames = getArray($playcode, $p_setnamestart, $p_setnameend);
        }
    } else {
        if ($p_playcodetype == 2) {
            //from api
            //		writetofile("d:\\s.txt",$linkcode) ;
            //		echo $p_playcodeApiUrlParamend .'=='.$playcodeApiUrlParamstart;
            //		echo $playcodeApiUrlParamstart .'\n' .$p_playcodeApiUrlParamend .'  = '.$playcodeApiUrltype;
            if ($playcodeApiUrltype == 0) {
                $paracode = getBody($linkcode, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend);
            } else {
                $paracode = getBody($UrlTestMoive, $playcodeApiUrlParamstart, $p_playcodeApiUrlParamend);
            }
            //		echo $paracode;
            $p_apibatchurl = replaceStr($playcodeApiUrl, "{PROD_ID}", $paracode);
            $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", 1);
            //		writetofile("d:\\ts.txt", $p_apibatchurls."\n");
            $playcode = getFormatPage($p_apibatchurls, $p_coding);
            //		echo $playcode."\n";
            $weburl = getArray($playcode, $p_playlinkstart, $p_playlinkend);
            //		writetofile("d:\\ts.txt",'aaaaa('.$p_playlinkstart.")\n\t(".$p_playlinkend.")\n\t");
            $page_num = 2;
            //		writetofile("d:\\ts.txt",$weburl);
            //		echo "page 1 :".$weburl .'\n';
            $flag = true;
            while ($flag && strpos($playcodeApiUrl, "{PAGE_NO}") !== false) {
                $p_apibatchurls = replaceStr($p_apibatchurl, "{PAGE_NO}", $page_num);
                //			echo $p_apibatchurls .'\n';
                $playcode = getFormatPage($p_apibatchurls, $p_coding);
                $weburls = getArray($playcode, $p_playlinkstart, $p_playlinkend);
                //		    writetofile("d:\\ts.txt", "page ".$page_num." :".$weburls .'\n');
                if ($weburls) {
                    $weburl = $weburl . "{Array}" . $weburls;
                    $page_num = $page_num + 1;
                } else {
                    $flag = false;
                }
            }
            //		var_dump($weburl);
            //		if ($p_playlinktype >0) {
            //			$weburl = getArray($playcode,$p_playlinkstart,$p_playlinkend);
            //		}
            //		else{
            //			$weburl = getArray($playcode,$p_playurlstart,$p_playurlend);
            //		//	var_dump($playcode);
            //		}
            //		if ($p_setnametype == 3) {
            //			$setnames = getArray($playcode,$p_setnamestart,$p_setnameend);
            //		}
        } else {
            if ($p_playlinktype > 0) {
                $weburl = getArray($linkcode, $p_playlinkstart, $p_playlinkend);
            } else {
                $weburl = getArray($linkcode, $p_playurlstart, $p_playurlend);
            }
            if ($p_setnametype == 3) {
                $setnames = getArray($linkcode, $p_setnamestart, $p_setnameend);
            }
        }
    }
    $titlecode = filterScript($titlecode, $p_script);
    $titlecode = replaceFilters($titlecode, $p_id, 1, 0);
    $starringcode = filterScriptStar($starringcode, $p_script);
    $directedcode = filterScriptStar($directedcode, $p_script);
    $timecode = filterScript($timecode, $p_script);
    $typecode = filterScript($typecode, $p_script);
    $areacode = filterScript($areacode, $p_script);
    $piccode = filterScript($piccode, $p_script);
    $remarkscode = filterScript($remarkscode, $p_script);
    $languagecode = filterScript($languagecode, $p_script);
    ?>
<form name="form" action="?action=saveok" method="post">
<table class="tb">
  	<tr>
  		<td  colspan="2" align="center">采 集 测 试 结 果</td>
  	</tr>
    <tr>
      <td width="20%">名称:</td>
      <td> <?php 
    echo $titlecode;
    ?>
  连载:<?php 
    echo $lzcode;
    ?>
 备注:<?php 
    echo $remarkscode;
    ?>
</td>
    </tr>
    <tr>
      <td>演员:</td>
      <td> <?php 
    echo $starringcode;
    ?>
 </td>
    </tr>
    <tr>
      <td>导演:</td>
      <td> <?php 
    echo $directedcode;
    ?>
 </td>
    </tr>
    <tr>
      <td>日期:</td>
      <td> <?php 
    echo $timecode;
    ?>
 </td>
    </tr>
    <tr>
      <td>栏目:</td>
      <td> <?php 
    echo $typecode;
    ?>
 </td>
    </tr>
    <tr>
      <td>地区:</td>
      <td> <?php 
    echo $areacode;
    ?>
 </td>
    </tr>
    <tr>
      <td>语言:</td>
      <td> <?php 
    echo $languagecode;
    ?>
 </td>
    </tr>
    <tr>
      <td>图片:</td>
      <td> <?php 
    echo getHrefFromImg($piccode);
    ?>
 </td>
    </tr>
    <tr>
      <td>介绍:</td>
      <td> <?php 
    echo strip_tags($contentcode);
    ?>
 </td>
    </tr>
    <?php 
    if ($weburl != False) {
        $webArray = explode("{Array}", $weburl);
        $setnamesArray = explode("{Array}", $setnames);
        $webArraTemp = array();
        $index = 0;
        $webUrls = '';
        for ($i = 0; $i < count($webArray); $i++) {
            $UrlTemp = $webArray[$i];
            if (strpos($webUrls, $UrlTemp . '<array>') === false) {
                $webArraTemp[$index] = $UrlTemp;
                $webUrls = $webUrls . $UrlTemp . '<array>';
                $index++;
            }
        }
        $webArray = $webArraTemp;
        for ($i = 0; $i < count($webArray); $i++) {
            $UrlTest = $webArray[$i];
            if ($p_playspecialtype == 1 && strpos("," . $p_playspecialrrul, "[变量]")) {
                $Keyurl = explode("[变量]", $p_playspecialrrul);
                $urli = getBody($UrlTest, $Keyurl[0], $Keyurl[1]);
                if ($urli == False) {
                    break;
                }
                $UrlTest = replaceStr($p_playspecialrerul, "[变量]", $urli);
            }
            if ($p_playspecialtype == 2) {
                $urArray = explode("/", $UrlTestMoive);
                //					writetofile("d:\\ts.txt","ss:".$UrlTestMoive);
                $ur = "";
                for ($k = 0; $k < count($urArray) - 1; $k++) {
                    $ur = $ur . $urArray[$k] . "/";
                }
                $UrlTest = $ur . $UrlTest . ".html";
            }
            //				writetofile("d:\\ts.txt", $UrlTest);
            if ($p_playlinktype == 1) {
                $UrlTest = getHrefFromLink($UrlTest);
                $UrlTest = definiteUrl($UrlTest, $strlisturl);
                $webCode = getPage($UrlTest, $p_coding);
                $url = getBody($webCode, $p_playurlstart, $p_playurlend);
                $url = replaceFilters($url, $p_id, 3, 0);
                $url = replaceLine($url);
                $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script);
                $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script);
                $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl;
            } else {
                if ($p_playlinktype == 2) {
                    $UrlTest = getHrefFromLink($UrlTest);
                    if (isN($p_playurlend)) {
                        $tmpA = strpos($UrlTest, $p_playurlstart);
                        $url = substr($UrlTest, strlen($UrlTest) - $tmpA - strlen($p_playurlstart) + 1);
                    } else {
                        $url = getBody($UrlTest, $p_playurlstart, $p_playurlend);
                    }
                } else {
                    if ($p_playlinktype == 3) {
                        $UrlTest = getHrefFromLink($UrlTest);
                        $UrlTest = definiteUrl($UrlTest, $strlisturl);
                        $webCode = getPage($UrlTest, $p_coding);
                        $tmpB = getArray($webCode, $p_playurlstart, $p_playurlend);
                        $tmpC = explode("{$Array}\$", $tmpB);
                        foreach ($tmpC as $tmpD) {
                            $url = $tmpD;
                            ?>
<tr>
					      <td>播放列表:</td>
					      <td> <?php 
                            echo $p_server_address . $UrlTest;
                            ?>
 </td>
					    </tr>
						<tr>
					      <td>地址:</td>
					      <td> <?php 
                            echo $p_server_address . $url;
                            ?>
 </td>
					    </tr>
						<?php 
                        }
                        break;
                    } else {
                        $url = replaceFilters($UrlTest, $p_id, 3, 0);
                        $url = replaceLine($url);
                        //					echo $url;
                        $webCode = getPage($UrlTestMoive, $p_coding);
                        $androidUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseAndroidVideoUrlByContent($webCode, $p_coding, $p_script);
                        $videoAddressUrl = ContentProviderFactory::getContentProvider($p_playtype)->parseIOSVideoUrlByContent($webCode, $p_coding, $p_script);
                        $videoAddressUrl = $androidUrl . '{====}' . $videoAddressUrl;
                        ?>
<tr>
					      <td>播放列表:</td>
					      <td> <?php 
                        echo $p_server_address . $UrlTestMoive;
                        ?>
 </td>
					    </tr>
					    <tr>
					      <td>视频地址列表:</td>
					      <td> <?php 
                        echo $p_server_address . replaceStr($videoAddressUrl, "\\", "");
                        ?>
 </td>
					    </tr>
						<tr>
					      <td>地址:</td>
					      <td> <?php 
                        echo $p_server_address . $url;
                        ?>
 </td>
					    </tr>
						<?php 
                        continue;
                    }
                }
            }
            if ($p_setnametype == 1) {
                $setname = getBody($url, $p_setnamestart, $p_setnameend);
                //					$url = $setname ."$" .$url;
            } else {
                if ($p_setnametype == 2 && $p_playlinktype == 1) {
                    $setname = getBody($webCode, $p_setnamestart, $p_setnameend);
                    //					$url = $setname ."$" .$url;
                } else {
                    if ($p_setnametype == 3) {
                        $setname = $setnamesArray[$i];
                        //					$url = $setnamesArray[$i] . "$" .$url;
                    }
                }
            }
            ?>
		    <tr>
		    <td>播放列表:</td>
			<td> <?php 
            echo $UrlTest;
            ?>
 </td>
		    </tr><tr>
					      <td>视频地址列表:</td>
					      <td> <?php 
            echo $p_server_address . replaceStr($videoAddressUrl, "\\", "");
            ?>
 </td>
					    </tr>
		    <tr>
			<td>地址:</td>
			<td> <?php 
            echo $url;
            ?>
  集数: <?php 
            echo filterScriptStar($setname, $p_script);
            ?>
 </td>
			</tr>
       <?php 
        }
    }
    ?>
	<tr>
	<td  colspan="2"><input name="button" type="button" class="btn" id="button" onClick="window.location.href='javascript:history.go(-1)'" value="上一步">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input name="Submit" type="submit" class="btn" id="Submit" value="完 成"></td>
	</tr>
</table>
</form>
<?php 
}
Ejemplo n.º 25
0
$timestamp = '';
if (isset($_GET['registration'])) {
    $lk = base64_decode($_GET['registration']);
    list($id, $timestamp) = explode('|', $lk);
}
if ($timestamp < $time - $link_life * 60 * 60 * 24 && !isset($_POST['login'])) {
    $error = $lang['signup_activate_link_expired'];
}
if (isset($_GET['registration']) && empty($error)) {
    $data = signup($SignupFile, $id);
    if ($data[7] == 1) {
        $error = $lang['signup_activate_invalid'];
    }
    if (empty($error)) {
        $replacement = $data[0] . '|' . $data[1] . '|' . $data[2] . '|' . $data[3] . '|' . $data[4] . '|' . $data[5] . '|' . $data[6] . '|1|' . $data[8] . '|';
        replaceLine($SignupFile, $id, $replacement);
        $success = '<strong>' . $lang['signup_activate_success_title'] . '</strong><br>' . $lang['signup_activate_success'];
    } else {
        $_SESSION["abuselogin"]++;
        $error = $lang['signup_activate_invalid'];
    }
}
if (!isset($_GET['registration'])) {
    $url = $_POST['login'];
    if (isset($_POST['login']) && !empty($_POST['username']) && !empty($_POST['password'])) {
        @($username = $_POST['username']);
        @($password = $_POST['password']);
        $data = signup($SignupFile, $username);
        $pass = password_decode($key, @$data[6]);
        if ($username == @$data[4] && $password == $pass) {
            if ($data[7] == 0) {
Ejemplo n.º 26
0
 }
 $new = $id . '|' . $item_id . '|' . $dd . '|' . $name . '|' . $username . '|' . $email . '|' . $password . '|' . $activate . '|' . $ip_address . '|';
 if ($_POST['update'] == 'update') {
     $profile = $cu[0] . '|' . $cu[1] . '|' . $cu[2] . '|' . $name . '|' . $username . '|' . $email . '|' . $password . '|' . $activate . '|' . $ip_address . '|';
     replaceLine($SignupFile, $cu[1], $profile);
     if ($ip_blocking == 0 && in_array($ip_address, $deny)) {
         replaceIP($IPFile, $ip_address, '');
     } elseif ($ip_blocking == 1 && !in_array($ip_address, $deny)) {
         $fp = fopen($IPFile, "a");
         fwrite($fp, $ip_address . "\n");
         fclose($fp);
     }
     $nw = db("db/newsletter/{$NewsletterData}.dat", $cu[5]);
     if ($email != $nw[0] || $name != $nw[1] || $username != $nw[2]) {
         $newdata = $email . '|' . $name . '|' . $username . '|';
         replaceLine("db/newsletter/{$NewsletterData}.dat", $cu[5], $newdata);
     }
 } else {
     $fp = fopen($SignupFile, "a");
     fwrite($fp, $new . "\n");
     fclose($fp);
     $nw = db("db/newsletter/{$NewsletterData}.dat", $email);
     if (empty($nw[0])) {
         $DataNewsletter = $email . '|' . $name . '|' . $username . '|';
         $fp = fopen("db/newsletter/{$NewsletterData}.dat", "a");
         fwrite($fp, $DataNewsletter . "\n");
         fclose($fp);
     }
     if ($ip_blocking == 1 && !in_array($ip_address, $deny)) {
         $fp = fopen($IPFile, "a");
         fwrite($fp, $ip_address . "\n");
Ejemplo n.º 27
0
        $ship = 'null';
    }
    @($DataItems = base64_decode($product_item));
    @($product = explode("|", $DataItems));
    if (file_exists("sessions/" . $cart . ".dat")) {
        $lines = array();
        $lines = file("sessions/" . $cart . ".dat");
        foreach ($lines as $thisline) {
            $thisline = trim($thisline);
            if (!empty($thisline)) {
                $contents = explode("|", $thisline);
                if ($contents[4] == $product[4]) {
                    $twice = true;
                    $contents[11]++;
                    $item = $DataItems . '|' . $price . '|' . $contents[11] . '|' . $option1 . '|' . $option2 . '|' . $tax . '|' . $ship . '|' . $discount1 . '|' . $discount2 . '|' . $ip . '|' . $cart;
                    replaceLine("sessions/" . $cart . ".dat", $product[4], $item);
                }
            }
        }
    }
    if (!isset($twice) && !empty($product_item)) {
        $item = $DataItems . '|' . $price . '|' . $qte . '|' . $option1 . '|' . $option2 . '|' . $tax . '|' . $ship . '|' . $discount1 . '|' . $discount2 . '|' . $ip . '|' . $cart;
        $fp = fopen("sessions/" . $cart . ".dat", "a");
        fputs($fp, $item . "|\n");
        fclose($fp);
    }
}
function discount($amount, $DiscountFile)
{
    $exist = FALSE;
    if (file_exists($DiscountFile)) {