Exemplo n.º 1
0
     }
     break;
 case 'secure':
     $sites = isadmin() ? ZVhosts::getVhosts() : ZVhosts::listMyVhosts();
     foreach ($sites as $v) {
         chmod("/home/{$v->owner}", 0711);
         chgrp($v->root, 'www');
         chmod($v->root, 0750);
     }
     setmsg(t('saved'), 'notice');
     break;
 case 'errdoc':
     $name = preg_replace("/[^0-9a-z\\-\\.]/", '', $_REQUEST['name']);
     $do = preg_replace("/[^0-9a-z\\-\\.]/", '', $_REQUEST['do']);
     $token = token();
     $vhost = ZVhosts::getVhost($name);
     $item = intval($_REQUEST['item']);
     $doc = (in_array($item, $error_documents) ? $item : 404) . '.shtml';
     $file = "{$home}/{$vhost->owner}/{$name}/{$doc}";
     if (checktoken()) {
         $content = $_REQUEST['content'];
         $written = file_put_contents($file, $content);
         if ($written) {
             chown($file, $vhost->owner);
             chgrp($file, $vhost->owner);
             chmod($file, 0755);
             setmsg(t('Saved'), 'notice', "?task=edit&name={$name}");
         }
     }
     if ($do == 'reset') {
         $def_dir = ZH . "/data/errdoc";
Exemplo n.º 2
0
function getVhost($domain)
{
    return ZVhosts::getVhost($domain);
}