Beispiel #1
0
                mkdir($stat_dir, 0710, true);
            }
            $d = dir($log_dir);
            $output[] = '<blockquote>';
            while (false !== ($f = $d->read())) {
                $file = PHP_OS == 'WINNT' ? 'access.log' : 'access_log';
                $log_file = $log_dir . "/{$f}/{$file}";
                if (is_file($log_file)) {
                    $output[] = "";
                    $output[] = "Processing {$s->name}/{$f} ...";
                    $cmd = "{$webalizer_path} -o {$stat_dir} -n {$s->name} {$log_file}";
                    $output[] = $cmd;
                    $output[] = array_pop(explode("\n", trim(shell_exec($cmd))));
                } else {
                    //var_dump($log_file);
                }
            }
            $output[] = "</blockquote>\n";
            $d->close();
        }
        $output = nl2br(join("\n", $output));
        break;
    case 'list':
    default:
        $task = 'list';
        $sites = isadmin() ? ZVhosts::getVhosts() : ZVhosts::listMyVhosts();
        break;
}
if (!$norender) {
    include template('site');
}
Beispiel #2
0
 function chkDomain($domain)
 {
     if (in_array($domain, ZVhosts::getDomains())) {
         return 'occupied';
     }
     return (bool) preg_match("/^[a-z0-9\\-\\.\\*]*\\.[a-z0-9\\-\\.]+[a-z0-9]\$/i", $domain);
 }
Beispiel #3
0
             $break = true;
         }
         // check domain
         if (true !== ($res = ZVhosts::chkDomain($domain))) {
             $err['domain'] = t('Domain Invalid.');
             if ($res == 'occupied') {
                 $err['domain'] = t('Domain Occupied.');
             }
             $break = true;
         }
         if ($break) {
             break;
         }
         // execute!
         $r1 = ZUser::adduser_request($username, $password, $package);
         $r2 = ZVhosts::addvhost($username, $domain);
         $r3 = ZDatabase::addmysqluser($username, $password);
         setmsg(t('Adduser request pending. It will take a few minutes to take into effect.'), 'notice');
     }
     break;
 case 'edit':
     $token = token();
     $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
     if (!isadmin() && $me != $name) {
         setmsg(t('Permission Denied.'));
         //break;
     }
     $name = preg_replace("/[^a-z0-9]+/i", "", $name);
     if (!$name) {
         redirect('user.php');
     }
function restart()
{
    return ZVhosts::restart();
}