| 1 |
<?php |
| 2 |
include("siwiki.header.php"); |
| 3 |
if(!isset($_SESSION['uid'])){ $_SESSION['uid'] = ""; } |
| 4 |
|
| 5 |
ChkVal($_SIWIKI['page'], 'page',''); |
| 6 |
|
| 7 |
$jscripts=""; |
| 8 |
$langLink = otherLangPage($_SIWIKI['langs'], $_SESSION['lang'], $_SIWIKI['category'], $fname, $sub); |
| 9 |
|
| 10 |
$flg_file = file_exists($_SIWIKI['filename']); |
| 11 |
$topDir = WikiDir('top'); |
| 12 |
$command_file = $topDir."/programs/wiki/".$sub.".php"; |
| 13 |
|
| 14 |
$check_user=get_user_level($_SESSION['uid']); |
| 15 |
|
| 16 |
//$ips[] = "192.168."; |
| 17 |
if($check_user > POWER_USER){ |
| 18 |
$is_admin = true; |
| 19 |
if(!file_exists($_SIWIKI['wiki_dir'])){ |
| 20 |
$sub="configure"; |
| 21 |
} |
| 22 |
} else{ |
| 23 |
$is_admin = false; |
| 24 |
} |
| 25 |
|
| 26 |
$COMMAND_LIST[0] = array("download", "downloadfile", "image", "video"); |
| 27 |
$COMMAND_LIST[GUEST_USER] = array("download", "downloadfile", "image", "video"); |
| 28 |
$COMMAND_LIST[LIMITED_USER] = $COMMAND_LIST[GUEST_USER]; |
| 29 |
$COMMAND_LIST[AVERAGE_USER] = array_merge($COMMAND_LIST[LIMITED_USER], array("list")); |
| 30 |
$COMMAND_LIST[POWER_USER] = array_merge($COMMAND_LIST[AVERAGE_USER], array("edit","new","Save", "autoSave","upload_file","delete_file", "SendFile","editComment","cms","logview","history","edit_menu","ReloadMenu","SaveMenu","downloadContent" )); |
| 31 |
$COMMAND_LIST[SITE_ADMIN] = array_merge($COMMAND_LIST[POWER_USER], array("backup", "dbaccess", "editUser", "configure")); |
| 32 |
$COMMAND_LIST[SYSTEM_ADMIN] = array_merge($COMMAND_LIST[SITE_ADMIN], array("farmware", "folder")); |
| 33 |
|
| 34 |
|
| 35 |
if(!$sub){ |
| 36 |
if(!$flg_file){ |
| 37 |
if($_SIWIKI['category']=='Home' && $_SIWIKI['pagename']=='index'){ |
| 38 |
$_SESSION['init_step'] = 1; |
| 39 |
$content = "<div id=\"wiki\">"; |
| 40 |
$content .= "Unknown Document root:"; |
| 41 |
$content.= $_SIWIKI['wiki_dir']; |
| 42 |
$content .= jumpUrl('install.php'); |
| 43 |
$content .= "</div>"; |
| 44 |
}else{ |
| 45 |
$content = "<div id=\"wiki\">"; |
| 46 |
$content .= "No such Document:"; |
| 47 |
$content.= $_SIWIKI['filename']; |
| 48 |
$content .= "</div>"; |
| 49 |
} |
| 50 |
}else{ |
| 51 |
$data = load_contexts_tree(); |
| 52 |
$cont = file_get_contents($_SIWIKI['filename']); |
| 53 |
$UPDATE = filemtime($_SIWIKI['filename']); |
| 54 |
|
| 55 |
$wiki_body = convert_to_body($cont); |
| 56 |
record_access_count($_SIWIKI['dirname']); |
| 57 |
if(!isset($subtitle)){ $subtitle = ""; } |
| 58 |
if(!isset($title)){ $title = ""; } |
| 59 |
$subtitle .= $wiki_body->title; |
| 60 |
|
| 61 |
$title .= $wiki_body->title; |
| 62 |
|
| 63 |
$content = "<div id=\"wiki\">"; |
| 64 |
$content .= "<div style=\"font-size:10pt;color:#884444;\">"; |
| 65 |
$content .= getContentTree($data, $_SIWIKI['pagename']); |
| 66 |
$content .="</div>\n"; |
| 67 |
$content .= $wiki_body->toString(); |
| 68 |
$content .= "</div>"; |
| 69 |
} |
| 70 |
}else{ |
| 71 |
if(file_exists($command_file)) { |
| 72 |
if( isset($COMMAND_LIST[$check_user]) && |
| 73 |
$COMMAND_LIST[$check_user] && |
| 74 |
in_array($sub, $COMMAND_LIST[$check_user])){ |
| 75 |
include("programs/wiki/$sub.php"); |
| 76 |
}else{ |
| 77 |
$content = file_get_contents($error401); |
| 78 |
} |
| 79 |
}else{ |
| 80 |
$content = file_get_contents($error404); |
| 81 |
|
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
if(isset($is_ajax) && $is_ajax){ |
| 87 |
print $content; |
| 88 |
}else{ |
| 89 |
|
| 90 |
|
| 91 |
if(!isset($_SIWIKI['member_only']) || !$_SIWIKI['member_only'] || $is_user) { |
| 92 |
$menu=getMenu(); |
| 93 |
|
| 94 |
$categorylist = mkCategoryList(); |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
if(file_exists($_SIWIKI['siwiki_dir']."/".TEMPLATEPATH . "/functions.php")){ |
| 99 |
include(TEMPLATEPATH . "/functions.php"); |
| 100 |
} |
| 101 |
include($_SIWIKI['template']); |
| 102 |
} |
| 103 |
|
| 104 |
?> |