Installation instructions for Dokuwiki version 2006-03-09d on Hosting.
+pubs http://www.middleware.vt.edu/pubs/{NAME} +media http://www.middleware.vt.edu/data/media/{NAME}
Make sure the data/media directory is world readable.
s/DOKU_BASE/'http:\/\/www.middleware.vt.edu\/'/g
s/DOKU_TPL/'http:\/\/www.middleware.vt.edu\/lib\/tpl\/default\/'/g
- <form action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> + <?php $secureHosting = 'https://secure.hosting.vt.edu'; ?> + <?php if (strstr(script(), 'www.middleware.vt.edu')) { ?> + <form action="<?php echo $secureHosting.script()?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> + <?php } else { ?> + <form action="<?php echo $secureHosting.'/www.middleware.vt.edu'.script()?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> + <?php } ?>
<? $conf['start'] = 'middleware'; $conf['title'] = 'MiddlewareWiki'; /* Authentication Options */ $conf['useacl'] = 1; $conf['superuser'] = '@admin'; $conf['openregister']= 0; $conf['authtype'] = 'edldap'; /* Ldap Options */ $conf['auth']['ldap']['server'] = 'ldap://authn.directory.vt.edu'; $conf['auth']['ldap']['usertree'] = 'ou=People,dc=vt,dc=edu'; $conf['auth']['ldap']['userfilter'] = '(uupid=%{user})'; $conf['auth']['ldap']['grouptree'] = 'ou=Groups,dc=vt,dc=edu'; $conf['auth']['ldap']['groupfilter'] = '(member=%{dn})'; $conf['auth']['ldap']['version'] = 3; $conf['auth']['ldap']['starttls'] = 1; ?>
<? require_once(DOKU_INC.'inc/auth/ldap.class.php'); class auth_edldap extends auth_ldap { function getUserData($user) { global $conf; if(!$this->_openLDAP()) return false; $info['user'] = $user; $info['server'] = $this->cnf['server']; if ($this->con) { @ldap_bind($this->con); $this->bound = false; } // get info for given user $base = $this->_makeFilter($this->cnf['usertree'], $info); if(!empty($this->cnf['userfilter'])) { $filter = $this->_makeFilter($this->cnf['userfilter'], $info); } else { $filter = "(ObjectClass=*)"; } $sr = @ldap_search($this->con, $base, $filter); $result = @ldap_get_entries($this->con, $sr); // Don't accept more or less than one response if($result['count'] != 1){ return false; //user not found } $user_result = $result[0]; ldap_free_result($sr); // general user info $info['dn'] = $user_result['dn']; $info['mail'] = $user_result['mail'][0]; $info['name'] = $user_result['cn'][0]; $info['grps'] = array(); //get groups for given user if grouptree is given if ($this->cnf['grouptree'] && $this->cnf['groupfilter']) { $base = $this->_makeFilter($this->cnf['grouptree'], $user_result); $filter = $this->_makeFilter($this->cnf['groupfilter'], $user_result); $authzParentGroup = 'uugid=middleware.wiki.authz'; $authzGroups = array(); $sr = @ldap_search($this->con, $base, $authzParentGroup, array('member')); $result = @ldap_first_entry($this->con, $sr); $authzGroups = ldap_get_values($this->con, $result, 'member'); unset($authzGroups['count']); ldap_free_result($sr); $sr = @ldap_search($this->con, $base, $filter, array()); $result = @ldap_get_entries($this->con, $sr); ldap_free_result($sr); $userGroups = array(); foreach($result as $grp){ if (!empty($grp)) $userGroups = array_merge($userGroups, $this->getGroupMembership($grp['dn'])); } foreach($userGroups as $grp) { if(in_array($grp, $authzGroups)) { $info['grps'][] = substr(strtok($grp, ','), strlen('uugid=')); } } } // always add the default group to the list of groups if(!in_array($conf['defaultgroup'],$info['grps'])) $info['grps'][] = $conf['defaultgroup']; return $info; } function getGroupMembership($group) { $groups = array($group); $grp = strtok($group, ','); $sr = @ldap_search($this->con, $this->cnf['grouptree'], $grp, array('groupMembership')); $result = @ldap_first_entry($this->con, $sr); if ($result !== false) { $parentGroups = @ldap_get_values($this->con, $result, 'groupMembership'); unset($parentGroups['count']); ldap_free_result($sr); if ($parentGroups !== false) { foreach($parentGroups as $parentGroup) { $groups = array_merge($groups, $this->getGroupMembership($parentGroup)); } } } return $groups; } } ?>
$lang['btn_print_view'] = 'Print view';
if($INFO['writable']){ if($INFO['exists']){ $r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + $r .= html_btn('print_view',$ID,'',array('do' => 'export_html')); }else{ $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); } } else { $r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); + $r .= html_btn('print_view',$ID,'',array('do' => 'export_html')); }
- ptln('<link rel="stylesheet" media="screen" type="text/css" href="'.DOKU_BASE.'lib/exe/css.php" />', $it); - ptln('<link rel="stylesheet" media="print" type="text/css" href="'.DOKU_BASE.'lib/exe/css.php?print=1" />', $it); + if ($ACT=='export_xhtml') { + ptln('<link rel="stylesheet" media="screen" type="text/css" href="http://www.middleware.vt.edu/lib/tpl/default/print.css" />', $it); + ptln('<link rel="stylesheet" media="print" type="text/css" href="http://www.middleware.vt.edu/lib/tpl/default/print.css" />', $it); + } else { + ptln('<link rel="stylesheet" media="screen" type="text/css" href="'.DOKU_BASE.'lib/exe/css.php" />', $it); + ptln('<link rel="stylesheet" media="print" type="text/css" href="'.DOKU_BASE.'lib/exe/css.php?print=1" />', $it); + }
- font: 12pt "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif; + font: 12pt "Times New Roman", Times, serif;
- font-family: "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif; + font-family: "Times New Roman", Times, serif;
$lang['btn_print_pdf'] = 'Export PDF';
if($INFO['writable']){ if($INFO['exists']){ $r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + $r .= html_btn('print_pdf',$ID,'',array('do' => 'export_pdf')); }else{ $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); } } else { $r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); + $r .= html_btn('print_pdf',$ID,'',array('do' => 'export_pdf')); }
- print p_wiki_xhtml($ID,$REV,false); + $HTML = p_wiki_xhtml($ID,$REV,false); + $HTML = preg_replace("'<div class=\"toc\">.*?</div>\n</div>'si",'',$HTML); + print $HTML;
function output_pdf($url) { require_once("html2pdf/html2fpdf.php"); $PDF = new HTML2FPDF(); $PDF->UseTableHeader(false); $PDF->AddPage(); $PDF->setBasePath(dirname(dirname(__FILE__))); $PDF->writeHTML(file_get_contents(html_entity_decode($url))); $PDF->Output(); }
CAS directory to a directory in the PHP search path.DB.php and the DB directory to a directory in the PHP search path.//send 404 for missing pages if configured if($conf['send404'] && !$INFO['exists']){ header('HTTP/1.0 404 Not Found'); } + if($ACT == 'login') { + phpCAS::setFixedServiceURL( + 'https://secure.hosting.vt.edu/www.middleware.vt.edu/doku.php?'. + $_SERVER["QUERY_STRING"]); + phpCAS::forceAuthentication(); + } + + if($ACT == 'logout') { + phpCAS::logout(); + }
<? require_once(DOKU_INC.'inc/auth/ldap.class.php'); require_once(DOKU_INC.'inc/auth/edldap.class.php'); include_once(DOKU_INC.'CAS/CAS.php'); phpCAS::client(CAS_VERSION_2_0, 'auth.vt.edu', 443, ''); class auth_cas extends auth_edldap { function auth_cas() { global $conf; $this->cando['external'] = true; $this->auth_edldap(); } function trustExternal($user,$pass,$sticky=false){ global $USERINFO; global $conf; $sticky ? $sticky = true : $sticky = false; //sanity check $session = $_SESSION[$conf['title']]['auth']; if(phpCAS::isAuthenticated()) { $user = phpCAS::getUser(); if(isset($session)) { $_SERVER['REMOTE_USER'] = $user; $USERINFO = $session['info']; $_SESSION[$conf['title']]['auth']['user'] = $user; $_SESSION[$conf['title']]['auth']['pass'] = $session['pass']; $_SESSION[$conf['title']]['auth']['info'] = $USERINFO; $_SESSION[$conf['title']]['auth']['buid'] = $session['buid']; } else { $USERINFO = $this->getUserData($user); $_SERVER['REMOTE_USER'] = $user; $_SESSION[$conf['title']]['auth']['user'] = $user; $_SESSION[$conf['title']]['auth']['pass'] = $pass; $_SESSION[$conf['title']]['auth']['info'] = $USERINFO; $_SESSION[$conf['title']]['auth']['buid'] = auth_browseruid(); } return true; } return false; } } ?>
- $conf['authtype'] = 'edldap'; + $conf['authtype'] = 'cas';