Exemplo n.º 1
0
 /**
  * Standard modular file removal function for OcCLE FS hooks.
  *
  * @param  array	The current meta-directory path
  * @param  string	The root node of the current meta-directory
  * @param  string	The file name
  * @param  array	A reference to the OcCLE filesystem object
  * @return boolean	Success?
  */
 function remove_file($meta_dir, $meta_root_node, $file_name, &$occle_fs)
 {
     if (get_forum_type() != 'ocf') {
         return false;
     }
     if (count($meta_dir) == 1) {
         //We're in a member's directory, and deleting one of their profile fields
         if (in_array($file_name, array('theme', 'avatar', 'validated', 'timezone_offset', 'primary_group', 'signature', 'banned', 'preview_posts', 'dob_day', 'dob_month', 'dob_year', 'reveal_age', 'e-mail', 'title', 'photo', 'photo_thumb', 'view_signatures', 'auto_monitor_contrib_content', 'language', 'allow_e-mails', 'notes', 'wide', 'max_attach_size'))) {
             return false;
         }
         //Can't delete a hard-coded (non-custom) profile field
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         $field_id = $GLOBALS['FORUM_DB']->query_value_null_ok('f_custom_fields f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=f.cf_name', 'f.id', array('text_original' => $file_name));
         if (is_null($field_id)) {
             $GLOBALS['FORUM_DRIVER']->install_create_custom_field($file_name, 10);
             $field_id = $GLOBALS['FORUM_DB']->query_value('f_custom_fields f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=f.cf_name', 'f.id', array('text_original' => $file_name));
         }
         ocf_delete_custom_field($field_id);
     } elseif (count($meta_dir) == 2) {
         if ($meta_dir[1] != 'groups') {
             return false;
         }
         //We're in a member's usergroup directory, and removing them from a usergroup
         require_code('ocf_groups_action');
         require_code('ocf_groups_action2');
         $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
         $group_id = array_search($file_name, $groups);
         if ($group_id !== false) {
             ocf_member_leave_group($group_id, $GLOBALS['FORUM_DRIVER']->get_member_from_username($meta_dir[0]));
         } else {
             return false;
         }
     } else {
         return false;
     }
     //Files shouldn't even exist anywhere else!
     return true;
 }
 /**
  * Standard aed_module delete actualiser.
  *
  * @param  ID_TEXT		The entry being deleted
  */
 function delete_actualisation($id)
 {
     ocf_delete_custom_field(intval($id));
 }
Exemplo n.º 3
0
 /**
  * Standard modular run function for setting features from the setup wizard.
  */
 function set_fields()
 {
     if (get_forum_type() != 'ocf') {
         return;
     }
     $dbs_back = $GLOBALS['NO_DB_SCOPE_CHECK'];
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     require_lang('ocf');
     if (post_param_integer('have_default_rank_set', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('f_groups', 'id', array('id' => db_get_first_id() + 8));
         if (!is_null($test)) {
             $promotion_target = ocf_get_group_property(db_get_first_id() + 8, 'promotion_target');
             if (!is_null($promotion_target)) {
                 $GLOBALS['SITE_DB']->query_update('f_groups', array('g_promotion_target' => NULL, 'g_promotion_threshold' => NULL, 'g_rank_image' => ''), array('id' => db_get_first_id() + 8), '', 1);
                 for ($i = db_get_first_id() + 4; $i < db_get_first_id() + 8; $i++) {
                     require_code('ocf_groups_action');
                     require_code('ocf_groups_action2');
                     ocf_delete_group($i);
                 }
             }
             $_name = ocf_get_group_property(db_get_first_id() + 8, 'name');
             if (is_integer($_name)) {
                 lang_remap($_name, do_lang('MEMBER'));
             }
         }
     }
     if (post_param_integer('have_default_full_emoticon_set', 0) == 0) {
         $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'f_emoticons WHERE e_code<>\':P\' AND e_code<>\';)\' AND e_code<>\':)\' AND e_code<>\':)\' AND e_code<>\':\\\'(\'');
     }
     if (post_param_integer('have_default_cpf_set', 0) == 0) {
         $fields = array('im_aim', 'im_msn', 'im_yahoo', 'im_skype', 'interests', 'location', 'occupation');
         foreach ($fields as $field) {
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('f_custom_fields f LEFT JOIN ' . get_table_prefix() . 'translate t ON t.id=f.cf_name', 'f.id', array('text_original' => do_lang('DEFAULT_CPF_' . $field . '_NAME')));
             if (!is_null($test)) {
                 require_code('ocf_members_action');
                 require_code('ocf_members_action2');
                 ocf_delete_custom_field($test);
             }
         }
     }
     $GLOBALS['NO_DB_SCOPE_CHECK'] = $dbs_back;
 }