preg_match("@{$hotlink_begin}\\s*(.*)\\s*{$hotlink_end}@sU", $hotlink, $out); $block = trim(array_pop($out)); $bWhitelist = !strncmp('# whitelist', $block, 11); preg_match_all("@\\?([^\\?/]+)/@", $block, $out); $hotlink_list = array_pop($out); $hotlinks = join("\n", $hotlink_list); ######################################### $redirect = $content; preg_match("@{$redirect_begin}\\s*(.*)\\s*{$redirect_end}@sU", $redirect, $out); $block = trim(array_pop($out)); //var_dump($block); $redirect = str_replace('Redirect ', '', $block); ######################################### break; case 'sync': if (syncVhosts()) { setmsg(t('Httpd configuration updated!'), 'notice'); } else { setmsg(t('Can not write the configuration file.'), 'error'); } 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':
function suspendVhost($domain, $state = 0) { return ZVhosts::suspendVhost($domain, $state) && syncVhosts(); }
$tpl_dir = ZH . "/tpl"; $d = dir($tpl_dir); $themes = array(); while ($f = $d->read()) { $param_file = "{$tpl_dir}/{$f}/param.ini"; if (!is_file($param_file)) { continue; } $param = parse_ini_file($param_file); $themes[] = (object) $param; } break; case 'sync': syncSystemUsers(); syncFtpUsers(); syncVhosts(); syncCBand(); syncCrontab(); setmsg(t('All data updated!'), 'notice'); break; case 'ctl': if (!isadmin()) { setmsg(t('Permission Denied')); } $a = strtolower($_REQUEST['a']); // Application $o = $_REQUEST['o']; // Operation if ($a == 'apache' && in_array($o, array('start', 'stop', 'restart'))) { $cmd = "/etc/init.d/apache2 {$o}"; } elseif ($a == 'proftpd' && in_array($o, array('start', 'stop', 'restart'))) {
function sync() { syncFtpUsers(); syncVhosts(); syncCBand(); syncSystemUsers(); syncCrontab(); syncQuota(); }