public function profileAction()
 {
     $proxy = new SxCms_Page_Proxy();
     $this->view->page = $proxy->getPageById('29', null, $this->_getParam('lng', 'nl'));
     //enable groups if they can choose them
     /*
     $proxy = new SxModule_Securedocs_Group_Proxy();
     $groups = $proxy->getAll();
     $this->view->groups = $groups;
     */
     $identity = Zend_Auth::getInstance()->getIdentity();
     $proxy = new SxModule_Members_Proxy();
     $item = $proxy->getById($identity->getId());
     if ($this->getRequest()->isPost()) {
         $item->setActive($this->_getParam('active'));
         $item->setLng($_SESSION['System']['lng']);
         //$this->_getParam('language')
         $item->setSex($this->_getParam('sex'));
         $item->setName($this->_getParam('name'));
         $item->setFirstName($this->_getParam('firstname'));
         $item->setCompany($this->_getParam('company'));
         $item->setWebsite($this->_getParam('website'));
         $item->setEmail($this->_getParam('email'));
         $item->setPassword($this->_getParam('password'));
         $item->setPhone($this->_getParam('phone'));
         $item->setFax($this->_getParam('fax'));
         $item->setMobilePhone($this->_getParam('mobilephone'));
         $item->setStreet($this->_getParam('street'));
         $item->setNumber($this->_getParam('number'));
         $item->setPostalcode($this->_getParam('postalcode'));
         $item->setPlace($this->_getParam('place'));
         $item->setCountry($this->_getParam('country'));
         $item->setBoardMember($this->_getParam('boardmember'));
         $item->setGroups($this->_getParam('groups'));
         //groups = array;
         /* validate post */
         if ($item->isValid()) {
             $item->save();
             $item->sendToAdmin();
             $this->view->success = "Aanpassingen succesvol opgeslagen";
         }
     }
     $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Members');
     $this->view->item = $item;
 }
示例#2
0
 public function controlPassword()
 {
     $proxy = new SxModule_Members_Proxy();
     if (!$proxy->checkPassword($this->getPassword(), $this->getEmail())) {
         $message = array('wrong' => "Wrong password.");
         $msg = Sanmax_MessageStack::getInstance('SxModule_Members');
         $msg->addMessage('password', $message, 'settings');
         return false;
     }
     return true;
 }
 public function addAction()
 {
     SxCms_Acl::requireAcl('securedocs', 'securedocs.add');
     $base = realpath(APPLICATION_PATH . '/../public_html/securedocs/');
     $path = base64_decode($this->_getParam('path'));
     if ($this->getRequest()->isPost()) {
         $uploadAdapter = new Zend_File_Transfer_Adapter_Http();
         $uploadAdapter->setDestination($base . $path);
         $uploadAdapter->setOptions(array('ignoreNoFile' => true));
         $uploadAdapter->receive();
         $files = $uploadAdapter->getFileName(null, true);
         foreach ($_FILES['file']['name'] as $key => $filename) {
             if (!$filename) {
                 continue;
             }
             $summary = $this->_getParam('samenvatting');
             $mail = $this->_getParam('mail', '');
             $file = $base . $path . '/' . $filename;
             $newfile = $base . $path . '/' . str_replace(" ", "", $filename);
             rename($file, $newfile);
             $file = new SxModule_Securedocs_File($newfile);
             $file->setPath($path);
             $file->setSummary($summary[$key]);
             $file->setMail(isset($mail[$key]) ? "1" : "0");
             $file->save();
             if ($mail[$key]) {
                 $groups = explode('/', $path);
                 $control = $path;
                 if ($control != "") {
                     $proxy = new SxModule_Securedocs_Folder_Proxy();
                     $folder = $proxy->getByFolder($groups[1]);
                     $folderId = $folder->getFolderId();
                     $proxy = new SxModule_Securedocs_Group_Proxy();
                     $groups = $proxy->getAllByMap($folderId);
                     $aantal = count($groups);
                     $q = 0;
                     $groupids = '(';
                     foreach ($groups as $group) {
                         $q++;
                         if ($q != $aantal) {
                             $groupids .= $group->getGroupId() . ",";
                         } else {
                             $groupids .= $group->getGroupId();
                         }
                     }
                     $groupids .= ')';
                     $proxy = new SxModule_Members_Proxy();
                     $members = $proxy->getAllByGroups($groupids);
                     foreach ($members as $member) {
                         $member->sendDocument($file);
                     }
                 }
             }
         }
         $this->_redirect('/admin/securedocs/index/path/' . base64_encode($path));
     }
     $this->view->path = $path;
     $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Securedocs_File');
 }
 public function activateAction()
 {
     SxCms_Acl::requireAcl('members', 'members.activate');
     $proxy = new SxModule_Members_Proxy();
     $item = $proxy->getById((int) $this->_getParam('id'), $_SESSION['System']['lng']);
     $item->activate();
     $flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $flashMessenger->addMessage($this->admin_tmx->_('memberstatusedited'));
     $this->_helper->redirector->gotoSimple('index', 'member');
 }
 public function indexAction()
 {
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         $this->_helper->redirector->gotoSimple('login', 'member');
     }
     $identity = Zend_Auth::getInstance()->getIdentity();
     //set base + path
     $base = APPLICATION_PATH . '/../public_html/securedocs/';
     $base = realpath($base);
     $path = base64_decode($this->_getParam('path'));
     if ($this->getRequest()->isPost()) {
         if ($this->_getParam('folder')) {
             if (!file_exists($base . $path . '/' . $this->_getParam('folder'))) {
                 mkdir($base . $path . '/' . $this->_getParam('folder'));
                 if ($path == '') {
                     //if path = '' add map in database
                     $newmap = new SxModule_Securedocs_Folder();
                     $newmap->setFoldername($this->_getParam('folder'));
                     $newmap->save();
                 }
                 $messages = 'Directory created !';
                 $this->view->messages = $messages;
             }
         } else {
             $adapter = new Zend_File_Transfer_Adapter_Http();
             $adapter->setDestination(realpath($base) . $path);
             $adapter->setOptions(array('ignoreNoFile' => true));
             $adapter->receive();
             if ($adapter->getFileName('filename')) {
                 $filename = realpath($adapter->getFileName('filename'));
                 $filename = str_replace(" ", "", array_pop(explode("/", $filename)));
                 $file = $adapter->getFileName('filename');
                 $newfile = $base . $path . '/' . $filename;
                 rename($file, $newfile);
                 $mail = $this->_getParam('mail');
                 if ($mail) {
                     $mail = 1;
                 } else {
                     $mail = 0;
                 }
                 $file = new SxModule_Securedocs_File($newfile);
                 $file->setMail($mail);
                 $file->setSummary($this->_getParam('samenvatting'));
                 $file->setPath($path);
                 $file->save();
                 $messages = 'File uploaded !';
                 $this->view->messages = $messages;
                 //als mail mag gest worden
                 if ($mail == '1') {
                     $groups = explode('/', $path);
                     //get folder id to find group
                     $proxy = new SxModule_Securedocs_Folder_Proxy();
                     $folder = $proxy->getByFolder($groups[1]);
                     $folderId = $folder->getFolderId();
                     //get group id's that allows the folder to find the members
                     $proxy = new SxModule_Securedocs_Group_Proxy();
                     $groups = $proxy->getAllByMap($folderId);
                     //Zend_Debug::dump($groups);die();
                     $aantal = count($groups);
                     $q = 0;
                     $groupids = '(';
                     foreach ($groups as $group) {
                         $q++;
                         if ($q != $aantal) {
                             $groupids .= $group->getGroupId() . ",";
                         } else {
                             $groupids .= $group->getGroupId();
                         }
                     }
                     $groupids .= ')';
                     $proxy = new SxModule_Members_Proxy();
                     $members = $proxy->getAllByGroups($groupids);
                     foreach ($members as $member) {
                         $member->sendDocument($file);
                     }
                 }
             }
         }
     }
     try {
         $it = new SxModule_Securedocs_Filesystem(realpath($base . $path));
     } catch (Exception $e) {
         $it = new SxModule_Securedocs_Filesystem($base);
         $path = '';
         $e;
     }
     /*maps waar lid toegang tot heeft*/
     $aantal = count($identity->getGroups());
     $groups = $identity->getGroups();
     $testempty = count($identity->getGroups()) == 1 && $groups[0] == '' ? true : false;
     if ($aantal != '0' && $testempty == false) {
         $q = 0;
         $groupids = '(';
         foreach ($identity->getGroups() as $group) {
             $q++;
             if ($q != $aantal) {
                 $groupids .= $group . ",";
             } else {
                 $groupids .= $group;
             }
         }
         $groupids .= ')';
         $proxy = new SxModule_Securedocs_Group_Proxy();
         $groepen = $proxy->getAllMapsByGroupIds($groupids);
         //uiteindelijk de mappen waar het lid toegang tot heeft
         $accessGroups = array();
         foreach ($groepen as $groep) {
             $accessGroups[] = $groep['foldername'];
         }
     } else {
         $accessGroups = array();
     }
     //check if member has fullacces
     if ($identity->getBoardMember() == '1') {
         $fullacces = true;
     } else {
         $fullacces = false;
     }
     /*get parentmap*/
     if ($this->_getParam('path')) {
         $parentmap = base64_decode($this->_getParam('path'));
         $parentmap = explode("/", $parentmap);
         $parentmap = $parentmap[1];
     } else {
         $parentmap = '';
     }
     /* sort the files */
     foreach ($it as $file) {
         if (isset($fullacces)) {
             $files[strtolower($file->getFilename())] = $file->key();
         } elseif (in_array($file, $accessGroups) || in_array($parentmap, $accessGroups)) {
             $files[strtolower($file->getFilename())] = $file->key();
         }
     }
     ksort($files);
     $showPath = explode('/', $path);
     for ($i = 1; $i < count($showPath); $i++) {
         $tmpPath = isset($showPath[$i - 1]['path']) ? $showPath[$i - 1]['path'] : '';
         $showPath[$i] = array('path' => $tmpPath . '/' . $showPath[$i], 'name' => $showPath[$i]);
     }
     array_shift($showPath);
     $this->view->accessgroups = $accessGroups;
     $this->view->fullAccess = $fullacces;
     $this->view->files = $files;
     $this->view->it = $it;
     $this->view->path = $path;
     $this->view->showpath = $showPath;
     $this->view->member = $identity;
 }