예제 #1
0
 /** reset limits
  * reset limits of this class: age limit, group limit, from limit, interval limit, order limit and all limits from upper class
  */
 function resetLimits()
 {
     parent::resetLimits();
     $_source_limit = NULL;
     $_external_id_limit = NULL;
     $_commsy_id_limit = NULL;
 }
예제 #2
0
 public function cs_wordpress_manager($environment)
 {
     global $c_use_soap_for_wordpress;
     #$c_wordpress_path_url;
     parent::cs_manager($environment);
     $this->wp_user = $this->_environment->getCurrentUser()->_getItemData();
     $portal_item = $this->_environment->getCurrentPortalItem();
     $wordpress_path_url = $portal_item->getWordpressUrl();
     #global $c_wordpress;
     if ($portal_item->getWordpressPortalActive()) {
         $this->CW = $this->getSoapClient();
     }
 }
예제 #3
0
 /** reset limits
  * reset limits of this class: age limit and all limits from upper class
  *
  * @author CommSy Development Group
  */
 function resetLimits()
 {
     parent::resetLimits();
     $this->_age_limit = NULL;
     $this->_type_limit = NULL;
     $this->_order_limit = NULL;
     $this->_list_limit = NULL;
     $this->_matrix_limit = NULL;
     $this->_label_limit = NULL;
     $this->_interval_limit = NULL;
     $this->_type_array_limit = array();
     $this->_user_userid_limit = NULL;
     $this->_user_authsourceid_limit = NULL;
     $this->_user_since_lastlogin_limit = NULL;
     $this->_no_interval_limit = false;
 }
예제 #4
0
 /**  delete a user item
  *
  * @param cs_user_item the user item to be deleted
  */
 function delete($item_id)
 {
     $user_item = $this->getItem($item_id);
     if ($this->_environment->inPortal()) {
         if (isset($user_item) and !empty($user_item) and $user_item->getContextID() == $this->_environment->getCurrentContextID()) {
             // delete private room - part I
             $private_room_manager = $this->_environment->getPrivateRoomManager();
             $own_room = $private_room_manager->getRelatedOwnRoomForUser($user_item, $this->_environment->getCurrentPortalID());
             if (isset($own_room) and !empty($own_room)) {
                 $room_id = $own_room->getItemID();
                 if (!empty($room_id)) {
                     $delete_own_room = true;
                 } else {
                     $delete_own_room = false;
                 }
             }
             // delete related user in project rooms and community rooms and private room
             $user_list = $user_item->getRelatedUserList();
             if (!$user_list->isEmpty()) {
                 $u_item = $user_list->getFirst();
                 while ($u_item) {
                     $u_item->delete();
                     $u_item = $user_list->getNext();
                 }
             }
             // delete private room - part II
             if (isset($delete_own_room) and $delete_own_room) {
                 $own_room->delete();
             }
         }
     } else {
         if ($this->_environment->inProjectRoom()) {
             if (isset($user_item) and !empty($user_item) and $user_item->getContextID() == $this->_environment->getCurrentContextID()) {
                 // delete related user in group rooms
                 if ($this->_environment->getCurrentPortalItem()->withGrouproomFunctions()) {
                     // get all grouprooms of this user
                     $grouproom_manager = $this->_environment->getGroupRoomManager();
                     $grouproom_list = $grouproom_manager->getUserRelatedGroupListForUser($user_item);
                     if (!$grouproom_list->isEmpty()) {
                         $grouproom_ids = array();
                         $grouproom = $grouproom_list->getFirst();
                         while ($grouproom) {
                             // is a group room of this project room?
                             $project_room = $grouproom->getLinkedProjectItem();
                             if (!empty($project_room)) {
                                 $project_room_id = $project_room->getItemID();
                                 if ($this->_environment->getCurrentContextID() == $project_room_id) {
                                     // add grouproom id to array of ids
                                     $grouproom_ids[] = $grouproom->getItemID();
                                 }
                             }
                             $grouproom = $grouproom_list->getNext();
                         }
                         // delete related users
                         if (!empty($grouproom_ids)) {
                             $user_manager = $this->_environment->getUserManager();
                             $user_manager->resetLimits();
                             $user_manager->setContextArrayLimit($grouproom_ids);
                             $user_manager->setUserIDLimit($user_item->getUserID());
                             $user_manager->setAuthSourceLimit($user_item->getAuthSource());
                             $user_manager->select();
                             $user_list = $user_manager->get();
                             unset($user_manager);
                             if (!$user_list->isEmpty()) {
                                 $user = $user_list->getFirst();
                                 while ($user) {
                                     // delete user
                                     $user->delete();
                                     $user = $user_list->getNext();
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // delete hash values
     $hash_manager = $this->_environment->getHashManager();
     $hash_manager->deleteHashesForUser($item_id);
     unset($hash_manager);
     $user_item->deleteAllEntriesOfUser();
     $current_datetime = getCurrentDateTimeInMySQL();
     $current_user = $this->_environment->getCurrentUserItem();
     $user_id = $current_user->getItemID();
     $query = 'UPDATE ' . $this->addDatabasePrefix('user') . ' SET ' . 'deletion_date="' . $current_datetime . '",' . 'deleter_id="' . encode(AS_DB, $user_id) . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting user.', E_USER_WARNING);
     } else {
         unset($result);
         parent::delete($item_id);
         return true;
     }
 }
예제 #5
0
 function mergeAccount($new_id, $old_id)
 {
     parent::mergeAccounts($new_id, $old_id);
     $query = 'UPDATE ' . $this->addDatabasePrefix('material_link_file') . ' SET deleter_id = "' . encode(AS_DB, $new_id) . '" WHERE deleter_id = "' . encode(AS_DB, $old_id) . '";';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems creating material_link_file from query: "' . $query . '"', E_USER_WARNING);
     }
 }
예제 #6
0
 /**  delete a dates item
  *
  * @param cs_dates_item the dates item to be deleted
  *
  * @access public
  * @author CommSy Development Group
  */
 function delete($item_id)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $current_user = $this->_environment->getCurrentUserItem();
     $user_id = $current_user->getItemID();
     $query = 'UPDATE ' . $this->addDatabasePrefix('dates') . ' SET ' . 'deletion_date="' . $current_datetime . '",' . 'deleter_id="' . encode(AS_DB, $user_id) . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting dates.', E_USER_WARNING);
     } else {
         $link_manager = $this->_environment->getLinkManager();
         $link_manager->deleteLinksBecauseItemIsDeleted($item_id);
         parent::delete($item_id);
         unset($result);
     }
 }
예제 #7
0
 /** delete a task
  * this method deletes a new task
  *
  * @param integer item_id item id of the task
  */
 function delete($item_id)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $current_user = $this->_environment->getCurrentUserItem();
     $user_id = $current_user->getItemID();
     unset($current_user);
     $query = 'UPDATE ' . $this->addDatabasePrefix('tasks') . ' SET ' . 'deletion_date="' . $current_datetime . '",' . 'deleter_id="' . encode(AS_DB, $user_id) . '",' . 'status="CLOSED"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting tasks from query: "' . $query . '"', E_USER_WARNING);
     } else {
         parent::delete($item_id);
     }
 }
예제 #8
0
 /** Prepares the db_array for the item
  *
  * @param $db_array Contains the data from the database
  *
  * @return array Contains prepared data ( textfunctions applied etc. )
  */
 function _buildItem($db_array)
 {
     if (!empty($db_array['extras'])) {
         include_once 'functions/text_functions.php';
         $db_array['extras'] = mb_unserialize($db_array['extras']);
     }
     return parent::_buildItem($db_array);
 }
예제 #9
0
 public function copyDataFromRoomToRoom($old_id, $new_id, $user_id = '', $id_array = '')
 {
     $retour = parent::copyDataFromRoomToRoom($old_id, $new_id, $user_id, $id_array);
     $tag_root_item_old = $this->getRootTagItemFor($old_id);
     if (isset($tag_root_item_old)) {
         $this->forceSQL();
         $tag_root_item_new = $this->getRootTagItemFor($new_id);
         if (isset($tag_root_item_new)) {
             $retour[$tag_root_item_old->getItemID()] = $tag_root_item_new->getItemID();
             unset($tag_root_item_new);
         }
     }
     unset($tag_root_item_old);
     return $retour;
 }
예제 #10
0
 function _buildItem($value)
 {
     $retour = parent::_buildItem($value);
     if (isset($value['from_item_id']) and !empty($value['from_item_id'])) {
         $retour->setFatherID($value['from_item_id']);
     }
     if (isset($value['room_title']) and !empty($value['room_title'])) {
         $retour->setRoomTitle($value['room_title']);
     }
     if (isset($value['room_activity']) and !empty($value['room_activity'])) {
         $retour->setRoomActivity($value['room_activity']);
     }
     return $retour;
 }
예제 #11
0
 function copyDataFromRoomToRoom($old_id, $new_id, $user_id = '', $id_array = '')
 {
     $retour = parent::copyDataFromRoomtoRoom($old_id, $new_id, $user_id, $id_array);
     // group all
     $this->reset();
     $this->setContextLimit($old_id);
     $this->setExactNameLimit('ALL');
     $this->select();
     $old_list = $this->get();
     if ($old_list->isNotEmpty() and $old_list->getCount() == 1) {
         $old_group_all = $old_list->getFirst();
         $this->reset();
         $this->setContextLimit($new_id);
         $this->setExactNameLimit('ALL');
         $this->select();
         $new_list = $this->get();
         if ($new_list->isNotEmpty() and $new_list->getCount() == 1) {
             $new_group_all = $new_list->getFirst();
             $retour[$old_group_all->getItemID()] = $new_group_all->getItemID();
             unset($new_group_all);
         }
         unset($old_group_all);
     }
     unset($old_list);
     // images of labels
     $query = '';
     $query .= 'SELECT * FROM ' . $this->addDatabasePrefix($this->_db_table) . ' WHERE context_id="' . encode(AS_DB, $new_id) . '" AND deleter_id IS NULL AND deletion_date IS NULL';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result)) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems getting data "' . $this->_db_table . '".', E_USER_WARNING);
     } else {
         foreach ($result as $query_result) {
             $extra_array = xml2Array($query_result['extras']);
             if (isset($extra_array['LABELPICTURE']) and !empty($extra_array['LABELPICTURE'])) {
                 $disc_manager = $this->_environment->getDiscManager();
                 $disc_manager->setPortalID($this->_environment->getCurrentPortalID());
                 if ($disc_manager->copyImageFromRoomToRoom($extra_array['LABELPICTURE'], $new_id)) {
                     $value_array = explode('_', $extra_array['LABELPICTURE']);
                     $value_array[0] = 'cid' . $new_id;
                     $extra_array['LABELPICTURE'] = implode('_', $value_array);
                     $update_query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET extras="' . encode(AS_DB, serialize($extra_array)) . '" WHERE item_id="' . $query_result['item_id'] . '"';
                     $update_result = $this->_db_connector->performQuery($update_query);
                     if (!isset($update_result) or !$update_result) {
                         include_once 'functions/error_functions.php';
                         trigger_error('Problems updating data "' . $this->_db_table . '".', E_USER_WARNING);
                     }
                 }
                 unset($disc_manager);
             }
         }
     }
     return $retour;
 }
예제 #12
0
 function delete($item_id)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET ' . 'deletion_date="' . $current_datetime . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting portfolio.', E_USER_WARNING);
     } else {
         parent::delete($item_id);
         $this->deletePortfolioTags($item_id);
         $this->deletePortfolioAnnotations($item_id);
         $this->deletePortfolioUsers($item_id);
         $this->deletePortfolioTemplateUsers($item_id);
     }
 }
예제 #13
0
 /**  delete a section item
  *
  * @param cs_section_item the section item to be deleted
  *
  * @access public
  */
 function delete($item_id, $version_id = NULL)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $current_user = $this->_environment->getCurrentUserItem();
     $user_id = $current_user->getItemID();
     $query = 'UPDATE ' . $this->addDatabasePrefix('section') . ' SET ' . 'deletion_date="' . $current_datetime . '",' . 'deleter_id="' . encode(AS_DB, $user_id) . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     if (!is_null($version_id)) {
         $query .= ' AND version_id="' . encode(AS_DB, $version_id) . '"';
     }
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting section from query: "' . $query . '"', E_USER_WARNING);
     } else {
         if (is_null($version_id)) {
             parent::delete($item_id);
         }
     }
 }
예제 #14
0
 function delete($item_id)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $user_id = $this->_current_user->getItemID();
     $query = 'UPDATE auth_source SET ' . 'deletion_date="' . $current_datetime . '",' . 'deleter_id="' . encode(AS_DB, $user_id) . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems deleting auth_source.', E_USER_WARNING);
     } else {
         parent::delete($item_id);
     }
 }
예제 #15
0
 function undelete($item_id)
 {
     $current_datetime = getCurrentDateTimeInMySQL();
     $current_user = $this->_environment->getCurrentUserItem();
     $user_id = $current_user->getItemID();
     $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET' . ' deletion_date=NULL,' . ' deleter_id=NULL,' . ' modification_date="' . $current_datetime . '",' . ' modifier_id="' . encode(AS_DB, $user_id) . '"' . ' WHERE item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result) or !$result) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems undeleting ' . $this->_db_table . '.', E_USER_WARNING);
     } else {
         parent::undelete($item_id);
     }
 }