本文整理汇总了PHP中unix::IsProtectedDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::IsProtectedDirectory方法的具体用法?PHP unix::IsProtectedDirectory怎么用?PHP unix::IsProtectedDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::IsProtectedDirectory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: folder_delete
function folder_delete()
{
$path = base64_decode($_GET["folder-remove"]);
$unix = new unix();
if ($unix->IsProtectedDirectory($path)) {
echo "<articadatascgi>" . base64_encode($path . " -> {failed} {protected}") . "</articadatascgi>";
exit;
}
writelogs_framework("path={$path}", __FUNCTION__, __FILE__, __LINE__);
shell_exec($unix->find_program("rm") . " -rf \"{$path}\"");
}
示例2: buildconf
function buildconf()
{
$sock = new sockets();
$unix = new unix();
$SargOutputDir = $sock->GET_INFO("SargOutputDir");
if ($SargOutputDir == null) {
$SargOutputDir = "/var/www/html/squid-reports";
}
if ($unix->IsProtectedDirectory($SargOutputDir, true)) {
$sock->SET_INFO("SargOutputDir", "/var/www/html/squid-reports");
$SargOutputDir = "/var/www/html/squid-reports";
}
if (!is_file("/etc/artica-postfix/old_SargOutputDir")) {
@file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
}
if ($SargOutputDir == "/usr/share/artica-postfix/squid") {
$SargOutputDir = "/var/www/html/squid-reports";
$sock->SET_INFO("SargOutputDir", "/var/www/html/squid-reports");
}
if ($SargOutputDir != "/usr/share/artica-postfix/squid") {
@mkdir("{$SargOutputDir}", 0755, true);
if (is_dir("/usr/share/artica-postfix/squid")) {
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
shell_exec("{$cp} -rf /usr/share/artica-postfix/squid/* \"{$SargOutputDir}/\"");
shell_exec("{$rm} -rf \"/usr/share/artica-postfix/squid\"");
@rmdir("/usr/share/artica-postfix/squid");
}
}
$old_SargOutputDir = @file_get_contents("/etc/artica-postfix/old_SargOutputDir");
if ($old_SargOutputDir != $SargOutputDir) {
@mkdir("{$SargOutputDir}", 0755, true);
if (is_dir($old_SargOutputDir)) {
$cp = $unix->find_program("cp");
$rm = $unix->find_program("rm");
shell_exec("{$cp} -rf \"{$old_SargOutputDir}/*\" \"{$SargOutputDir}/\"");
if (!$unix->IsProtectedDirectory($old_SargOutputDir, true)) {
shell_exec("{$rm} -rf \"{$old_SargOutputDir}\"");
@rmdir($old_SargOutputDir);
}
if (!is_dir($old_SargOutputDir)) {
@file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
}
} else {
@file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
}
}
events("Output dir: {$SargOutputDir}");
$SargConfig = unserialize(base64_decode($sock->GET_INFO("SargConfig")));
$SargConfig = SargDefault($SargConfig);
if ($SargConfig["lastlog"] == 0) {
$SargConfig["lastlog"] = 90;
}
$SargConfig["lastlog"] * 24;
$conf[] = "language {$SargConfig["language"]}";
$conf[] = "graphs {$SargConfig["graphs"]}";
$conf[] = "title \"{$SargConfig["title"]}\"";
$conf[] = "topsites_num {$SargConfig["topsites_num"]}";
$conf[] = "topuser_num {$SargConfig["topuser_num"]}";
$conf[] = "report_type {$SargConfig["report_type"]}";
$conf[] = "topsites_sort_order CONNECT {$SargConfig["topsites_sort_order"]}";
$conf[] = "index_sort_order {$SargConfig["index_sort_order"]}";
$conf[] = "resolve_ip {$SargConfig["resolve_ip"]}";
$conf[] = "user_ip {$SargConfig["user_ip"]}";
$conf[] = "exclude_hosts /etc/squid3/sarg.hosts";
$conf[] = "date_format {$SargConfig["date_format"]}";
$conf[] = "records_without_userid {$SargConfig["records_without_userid"]}";
$conf[] = "long_url {$SargConfig["long_url"]}";
$conf[] = "lastlog {$SargConfig["lastlog"]}";
$conf[] = "index yes";
$conf[] = "index_tree file";
$conf[] = "overwrite_report yes";
$conf[] = "mail_utility mail";
$conf[] = "hostalias /etc/squid3/sarg-aliases";
$conf[] = "exclude_codes /etc/squid3/sarg-exclude_codes";
$conf[] = "temporary_dir /tmp";
$conf[] = "date_time_by bytes";
$conf[] = "show_sarg_info no";
$conf[] = "show_sarg_logo no";
$conf[] = "external_css_file /sarg.css";
$conf[] = "ulimit none";
$conf[] = "squid24 off";
$conf[] = "output_dir {$SargOutputDir}";
$conf[] = "logo_image /logo.gif";
$conf[] = "image_size 160 58";
$conf[] = "access_log /var/log/squid/access.log";
$conf[] = "realtime_access_log_lines 5000";
$conf[] = "graph_days_bytes_bar_color orange";
$conf[] = "";
add_defaults();
$q = new mysql_squid_builder();
$sql = "SELECT * FROM sarg_aliases ORDER BY `pattern`";
$results = $q->QUERY_SQL($sql);
$a = array();
while ($ligne = mysql_fetch_assoc($results)) {
$zline = "{$ligne["pattern"]}";
if ($ligne["group"] != null) {
$zline = $zline . " {$ligne["group"]}";
}
if (trim($ligne["replace"] == null)) {
//.........这里部分代码省略.........
示例3: folder_delete
function folder_delete()
{
$path = base64_decode($_GET["folder-remove"]);
$path = utf8_encode($path);
$unix = new unix();
if ($_GET["emergency"] != "yes") {
if ($unix->IsProtectedDirectory($path)) {
echo "<articadatascgi>" . base64_encode($path . " -> {failed} {protected}") . "</articadatascgi>";
exit;
}
}
writelogs_framework("path={$path}", __FUNCTION__, __FILE__, __LINE__);
if (!is_dir($path)) {
writelogs_framework("{$path} no such directory", __FUNCTION__, __FILE__, __LINE__);
return;
}
$cmd = $unix->find_program("rm") . " -rf \"{$path}\"";
writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
}
示例4: delete_cache
function delete_cache()
{
$directory = base64_decode($_GET["delete-cache"]);
if (trim($directory) == null) {
return;
}
if (!is_dir($directory)) {
return;
}
$unix = new unix();
if ($unix->IsProtectedDirectory($directory, true)) {
return;
}
$rm = $unix->find_program("rm");
$nohup = $unix->find_program("nohup");
shell_exec("{$nohup} {$rm} -rf \"{$directory}\" >/dev/null 2>&1 &");
}
示例5: SambaInfos
function SambaInfos($path)
{
if (!is_object($GLOBALS["USERMENUS"])) {
$users = new usersMenus();
$GLOBALS["USERMENUS"] = $users;
} else {
$users = $GLOBALS["USERMENUS"];
}
if (!is_object($GLOBALS["SMBCLASS"])) {
$smb = new samba();
$GLOBALS["SMBCLASS"] = $smb;
} else {
$smb = $GLOBALS["SMBCLASS"];
}
if (substr($path, strlen($path) - 1, 1) == '/') {
$path = substr($path, 0, strlen($path) - 1);
}
$unix = new unix();
$sock = new sockets();
$q = new mysql();
$path_encoded = base64_encode($path);
$sql = "SELECT COUNT(ID) AS tcount FROM backup_schedules";
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$schedules_number = $ligne["tcount"];
if ($users->NFS_SERVER_INSTALLED) {
$nfs = imgtootltip('folder-granted-add-48-nfs.png', '{share_this_NFS}', "NFSShare2('{$path}')");
}
if ($users->SAMBA_INSTALLED) {
$shareit = imgtootltip('folder-granted-add-48.png', '{share_this}', "CFSShare('{$path}')");
if ($smb->main_shared_folders[$path] != null) {
$txt = "<div style='padding:2px;margin:5px;border:1px solid #CCCCCC'>{FOLDER_IS_SHARED}</div>";
$removeShare = imgtootltip('folder-granted-remove-48.png', '{delete_share}', "CFSUnShare('{$smb->main_shared_folders[$path]}','{$path}')");
$ShareProperties = imgtootltip('folder-granted-properties-48.png', '{privileges_settings}', "FolderProp('{$smb->main_shared_folders[$path]}')");
$shareit = $removeShare;
}
}
if ($sock->GET_INFO("RsyncDaemonEnable") == 1) {
$share_rsync = imgtootltip('folder-granted-add-rsync-48.png', '{share_this_rsync}', "RsyncShare('{$path}')");
include_once dirname(__FILE__) . "/ressources/class.rsync.inc";
$rsync = new rsyncd_conf();
if (is_array($rsync->main_array["{$path}"])) {
$share_rsync = imgtootltip('folder-granted-remove-rsync-48.png', '{unshare_this_rsync}', "UnshareRsync('{$path}')");
$share_rsync_properties = imgtootltip('folder-granted-properties-rsync-48.png', '{share_this_rsync}', "RsyncShare('{$path}')");
}
}
if ($schedules_number > 0) {
$backup = imgtootltip('48-backup.png', '{backup_this_directory}', "Loadjs('backup.tasks.php?FOLDER_BACKUP={$path_encoded}')");
}
$id = md5($id);
$parent = str_replace("/" . basename($path), "", $path);
$parent_id = md5($parent);
$addfolder = imgtootltip('folder-48-add.png', '{add_sub_folder}', "CreateSubFolder('{$path}')");
$delfolder = imgtootltip('folder-delete-48.png', '{del_sub_folder}', "DeleteSubFolder('{$path}','{$parent}','{$parent_id}')");
$folder_refresh = imgtootltip('folder-refresh-48.png', '{refresh}', "RefreshFolder('{$path}','{$id}')");
$acls = imgtootltip('folder-acls-48.png', '{acls_directory}', "Loadjs('samba.acls.php?path={$path_encoded}')");
$upload = imgtootltip('folder-upload-48.png', '{upload_a_file}', "FileUpload('{$path_encoded}')");
if ($unix->IsProtectedDirectory($path)) {
$delfolder = imgtootltip('folder-delete-48-grey.png', '{del_sub_folder}', "");
$addfolder = imgtootltip('folder-48-add-grey.png', '{add_sub_folder}', "");
$acls = null;
}
if ($users->IfIsAnuser()) {
$removeShare = null;
$ShareProperties = null;
$shareit = null;
$nfs = null;
$acls = null;
$share_rsync = null;
$share_rsync_properties = null;
$ct = new user($_SESSION["uid"]);
if ($ct->homeDirectory == $path) {
$delfolder = imgtootltip('folder-delete-48-grey.png', '{del_sub_folder}', "");
}
}
if ($backup == null) {
$backup = $acls;
$acls = " ";
}
if ($_GET["select-file"] != null) {
$removeShare = null;
$ShareProperties = null;
$shareit = null;
$nfs = null;
$acls = null;
$share_rsync = null;
$share_rsync_properties = null;
$backup = $upload;
$addfolder = null;
$delfolder = null;
}
$html = "\n{$txt}\n<table style='width:130px'>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$addfolder}</td>\n\t\t\t<td width=1% valign='top'>{$delfolder}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$backup}</td>\n\t\t\t<td width=1% valign='top'>{$folder_refresh}</td>\n\t\t</tr>\n\t\t<tr>\t\n\t\t\t<td width=1% valign='top'>{$shareit}</td>\n\t\t\t<td width=1% valign='top'>{$ShareProperties}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>{$nfs}</td>\n\t\t\t<td width=1% valign='top'>{$acls}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$share_rsync}</td>\n\t\t\t<td width=1% valign='top'>{$share_rsync_properties}</td>\n\t\t</tr>\t\t\n\t</table>";
$tpl = new templates();
return $tpl->_ENGINE_parse_body($html, "samba.index.php");
}