]> git.sur5r.net Git - contagged/blobdiff - entry.php
Support for national letter tabs
[contagged] / entry.php
index b79bc69680ae49bc1ed2ad62b4e66b856eac25e5..9edd1717023604763444909f21697fa163b46aa2 100644 (file)
--- a/entry.php
+++ b/entry.php
@@ -2,6 +2,11 @@
 require_once('inc/init.php');
 ldap_login();
 
+if ($conf['userlogreq'] && !isset($_SESSION['ldapab']['username'])){
+  header('Location: login.php');
+  exit();
+}
+
 $users = get_users();
 
 //select template to use
@@ -84,8 +89,9 @@ function _fetchData($dn){
   global $smarty;
   global $users; //contains the users for manager role
 
-  $sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)');
-  if(!ldap_count_entries($LDAP_CON,$sr)){
+  $sr = @ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)');
+  tpl_ldaperror();
+  if(!@ldap_count_entries($LDAP_CON,$sr)){
     return false;
   }
   $result = ldap_get_binentries($LDAP_CON, $sr);
@@ -127,7 +133,7 @@ function _saveData(){
   $now    = time();
   $newdn  = 'uid='.$now;
   if (empty($_REQUEST['type'])) { $_REQUEST['type']='public'; }
-  if($_REQUEST['type'] == 'private'){
+  if($_REQUEST['type'] == 'private' && $conf['privatebook']){
     $newdn .= ', '.$conf['privatebook'].', '.$_SESSION['ldapab']['binddn'];
   }else{
     $newdn .= ', '.$conf['publicbook'];
@@ -213,6 +219,8 @@ function _delEntry($dn){
  * gets the binary data from an uploaded file
  */
 function _getUploadData(){
+  global $smarty;
+  global $lang;
   $file = $_FILES['photoupload'];
 
   if (is_uploaded_file($file['tmp_name'])) {
@@ -222,7 +230,11 @@ function _getUploadData(){
       fclose($fh);
       unlink($file['tmp_name']);
       return $data;
+    } else {
+      $smarty->assign('jpegError',$lang['err_wrongFileType']);
     }
+  } else {
+    $smarty->assign('jpegError',$lang['err_fileNotUploaded']);
   }
   return '';
 }