/** * upgrade_to_1_1_0 function. * * @access private * @return void */ private function upgrade_to_1_1_0() { if ($this->Database->tableExists('tl_secure_accessdata')) { // Read fields decrypt them an save them $objData = \SecureAccessdataModel::findAll(); if ($objData !== null) { while ($objData->next()) { $arrSet = array(); // Set vars for update $objData->access_title = \Encryption::decrypt($objData->access_title) == '' ? $objData->access_title : \Encryption::decrypt($objData->access_title); $objData->author = \Encryption::decrypt($objData->author) == '' ? $objData->author : \Encryption::decrypt($objData->author); // Save $objData->save(); } } } }
/** * @param bool $isOnlyIDs * @return array */ public function filterFields($isOnlyIDs = false) { $arrClosedEntries = array(); // Get all secure accessdata results $objSecureAccessdata = \SecureAccessdataModel::findAll(); if ($objSecureAccessdata !== null) { while ($objSecureAccessdata->next()) { $id = $objSecureAccessdata->id; $author = $objSecureAccessdata->author; $protect = \Encryption::decrypt($objSecureAccessdata->protect); $protect_users = \Encryption::decrypt(deserialize($objSecureAccessdata->protect_users)); $protect_groups = \Encryption::decrypt(deserialize($objSecureAccessdata->protect_groups)); // If protected if ($protect == 1) { // If not admin if ($this->User->admin != 1) { // If not author if ($this->User->id != $author) { // If not in user array if (!(is_array($protect_users) && in_array($this->User->id, $protect_users))) { // If not in group array if (!(is_array($this->User->groups) && is_array($protect_groups) && count(array_intersect($this->User->groups, $protect_groups)) > 0)) { if ($isOnlyIDs == true) { $arrClosedEntries[] = $id; } else { $arrClosedEntries[] = array('id!=?', $id); } } } } } } } } return $arrClosedEntries; }