free health tips graphic
Home
Daily Tips Archive
Blog
Resources
Marketplace
Food and Drink
Herbs
Spas / Resorts
Supplements
Unique Gifts
Tea and Wine
Green Planet Ideas
Sustainable Gardening
Home and Office
Exercise and Yoga
Educational Materials
Travel and Sports
Articles
 

Sustainable Gardening Marketplace


Gardeners will find the best products for an environmentally responsible and healthy garden, orchard, or flower bed around their homes, in their neighborhoods, or even in Community Gardens. Over 2000 items include many effective alternatives to harsh chemicals and deserve a place in your growing plans for healthy food, flora, and fauna.


 
 
 
 
Terms of Service    Privacy Statement   Site Map   Contact Us  

©All Rights Reserved 2007, 2008 FreeHealthIdeas.com


width="800" height="100" align="center">'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?> YLE="color:#000000; font-weight: bold; font-family: arial; font-size: 10pt">Stretching is better for your body than most people realize, especially when you wake up in the morning and when you want to exercise your brain. That's correct...you can do more for your muscles, tendons, and ligaments when you close your eyes and imagine a good stretch with your Mind. Research indicates that stretching assists in the daily tonification of the skeletal and muscular systems, in addition to helping your lymphatic circulation improve with a regular daily routine. Take ten minutes in the morning upon arising to gently stretch and get your day off to a healthy start!


The Vision Impaired...Value This Pair :
10-26-2007

Many people find that they just can't ignore their eyes when tenderness and sensitivity from smoke or foreign substances get into them, causing irritation or blurred vision. Reach for this superlative product to clear the eyes and calm the inflammatory response. First take pure water from the distiller and cleanse them thoroughly. Next place two drops of MSM Water Drops into each eye, blink, and rest your eyes for awhile. These Drops have Ionic Copper, Zinc, and Silver in the formula, so if there is any infectious agent - it will be addressed along with the irritation. You can repeat this hourly until your eyes feel alright again.


Healthy Halloween Treats :
10-25-2007

What choices do you have to offer the children a healthy Halloween Treat? Our favorite single serving candy treat for this holiday season is made by a Wyoming company called Queen Bee Gardens. Their Praline Pecan Pearls are fabulous and incredibly delicious. These pralines are made with Honey. You will feel good when you hand out these healthy candies this Halloween, especially when you unwrap one or two for yourself.

Queen Bee


Soothing Smoke-Filled Lungs :
10-24-2007

If your Lungs are feeling damaged by smoke from any source, even from Wildfires in California or a cigarette in the office next to yours; then you can soothe those inflamed Lung tissue with the Essential Oils of Lavender, Eucalyptus, and Myrrh.

You simply use a Diffuser to disperse the Essential Oils into the air and inhale normally. You may also put a drop or two on your wrists and in the palm of your hands, rub them together briskly, and hold your palms to your nostrils and breathe deeply. Hold! Exhale and repeat the inhalation process.


Grass-Fed Beef: What's For Dinner :
10-23-2007

Today Alice Waters appeared on Martha Stewart's TV Show and promoted Sustainable Local Farming and Food Preparation using organic Whole Foods - just like we do here every day! Alice Waters prepared grass-fed beef, salad, and roasted potatoes while discussing beans and her approach to food, eating together at the table, and healthy farming practices.

Martha mentioned that besides Whole Foods Market in her area, it is difficult to find Grass-Fed Beef; so we want to remind you that we offer THREE Providers on our Food and Drink pages who will ship these fine meats to you directly.

Montana Legend
Niman Ranch
Fossil Farms


Pets Are Overweight - Why and What To Do Now :
10-22-2007

Have you noticed that our pets, especially our dogs and cats are becoming more obese and overweight right along with their human counterparts in the last decade?

The synthetic hormones added to human and pet food and the fact that pet owners feed their animals from their plates gives you a good idea of the "why". Now pet owners are asking "what" to do now to reverse the problem, so pets can regain their health.

You must find natural and organic pet food for your dogs and cats. You must also choose to eat healthy food, if you are going to continue to feed your animals from your plate. You need to provide your animals a detox program gradually, once they have adapted to a healthy dietary routine to gently remove the synthetic chemicals from their bodies.

Vivo Animals


Clean and Sanitize Those School Desks Better Yourself! :
10-21-2007

Video from GMA shows a fellow in a hazmat suit wiping down a school desk, but the thing is - that he is not doing a good job of it! You can watch as he misses most of the chair and the edges of the desks. There is no excuse for this lousy job that leaves the areas touched by students at risk.

You must have your children do a better job themselves and you must give them the products to take to school to get the job done correctly!

Essential Oils of Oregano, Cinnamon, Clove, Thyme, Lemon, and Eucalyptus, and Rosemary makes a superior blend which is clinically proven to kill bacteria and viral pathogens. Rosewood has been clinically proven to destroy bacteria. Nutri-Biotic mixed with pure water also is clinically-proven to kill these Staph micro-organisms. Use them wisely!


Eyelashes - Fake Them Out :
10-20-2007

It is no longer fashionable to wear false eyelashes. In fact, if you present that false image to the world about your eyelash length; then what else are you willing to falsify? Eyelashes are just the perfect way to protect the eye naturally and people who respect what is natural will also respect you for keeping your real eyelashes just the way they are - natural! The synthetic chemicals in mascara, glue, and eyeliner can damage they delicate tissue and cause allergic responses. Get rid of the Fake ones and keep the Natural Look!


High Heels are Not Natural! :
10-19-2007

Get rid of those high heel shoes! High heels are not natural and will cause many health problems for your feet, spine, and muscles. Many headaches and backaches are caused by those nasty heels which defy gravity and common sense! You owe it to your feet and the rest of your body to abstain from high heels.


The Sweet Success of Natural Sweeteners :
10-18-2007

There are many reasons to stop using refined sugar. Now there are alternatives which offer healthy ways to sweeten any food or beverage. In addition to honey, agave syrup, stevia, maple syrup, and several other natural substances are preferable to refined sugar.


Get the Lead Out :
10-17-2007

Liquid Zeolite is one of the most effective substances that "Gets the Lead Out" of your body when you have been exposed to toxic lead or other heavy metals. The body was never designed to metabolize industrialized substances like these heavy metals, so the body requires assistance in successfully eliminating lead, mercury, cadmium, nickel, and other poisonous metals.


Yogurt Culture Goes Live :
10-16-2007

There are many advertisements on TV and on the Net for products that have beneficial cultures of acidophilus and bifidus from yogurt to supplements. They state that they will aid in digestion and weight management.

There is no better substitute for the real yogurt and kefir than from a company called Life Sciences - the product is known as Nature's Biotics. If you simply cannot eat yogurt or kefir; then Nature's Biotics is your best choice for restoring ALL the different cultures in one supplement.

Nature's Biotics


Going Green in the Office :
10-15-2007

There is a big push to "Go Green" by taking an inventory of your "Footprint" on the planet and the simple changes you can make to do your individual part for environmental responsibility and sustainability.

One of the most important changes that you can make in your everyday life for a healthy workplace is to use office supplies that are "Green". It is often difficult to find these in local stores, so here are two online Office Products suppliers who carry and specialize in the "Green Office".

Green Office
Buy Green


Sea Food to the Rescue :
10-14-2007
'; echo "\n"; ?>

Vital Choice Seafood
Mountain Rose Herbs


Getting to the Heart of the Matter :
10-13-2007

In the tenets of Traditional Chinese Medicine, there are specific foods and flavors which correlate to each organ and system of your body...and when eaten will nourish and balance those parts of the physical body through the energetic exchange of that food's lifeforce.

The heart and circulatory system is strengthened by foods, flavors, and herbs which tonify the Fire Element...one of which is beef. Yet in these times it behooves you to be extremely selective about your source of meat. Here are three reliable and trustworthy Suppliers who provide healthy beef and related game meats that you can order online...getting to the "Heart" of the matter!

Montana Legend
Niman Ranch
Fossil Farms


Soda Can Be Healthy :
10-12-2007

Your traditional soda pop is far from being considered a healthy beverage, nearly as far from being even classified as a part of any food group as it can get, perhaps as far from being worth consuming as any substance on the face of the earth short of poison...

So what do you do when you want a bubbly soda that could be given the distinction of being remotely recommended for quenching your thirst in a healthy manner?

You go to the FUN company out of Seattle that produces a healthy soda. You can find the Link on our Menu and drink to your heart's conteor:#339900;font-family:arial,helvetica,sans-serif; font-weight: bold; arial,helvetica,sans-serif; font-size: 12pt">Healthy Living includes Longevity :
10-11-2007

Longevity is one aspect of Healthy Living which deserves a great deal of your personal attention. You are worthy of learning what you can do in your daily Life to increase your Lifespan and add many more years to a Lifetime which is lived in health and happiness.

A long and healthy Life means much more than regular medical check-ups from medical clinics and specialists in the field of Geriatrics. Longevity is only truly possible when you implement daily behavior which directly supports healthy Lifestyle choices.


Natural Solutions for Salmonella Poisoning :
10-10-2007

Banquet Turkey and Chicken Pot Pie frozen dinner Salmonella scare is falling just short of a Recall at this point in time. At least the Media is reporting the problem, so that people can check their freezers to throw away or return the identified dinners.

People who buy a particular brand like Banquet for years can be lulled into complacency and disregard a potential risk of food poisoning with contamination as loyal consumers. This is one of the best reasons to take a daily regimen of GSE drops in pure water in order to prevent any exposure from causing health problems.

GSE Information


Travel and Healthy Food :
10-9-2007

When you travel, it is often a challenge to find healthy food while you are enroute or once you reach your destination. You can plan to expect restaurants or grocery stores to be available, but that's not always going to be the case. Put together a Travel Kit with food items you know you will like until you have time to shop or locate a suitable eating establishment. Include snacks, drinks, even some camping equipment for plates, utensils, and clean-up supplies. Travel prepared and your trip will be much more enjoyable and healthy for you.


Warming Up On Cooler Nights! :
10-8-2007

So...you find yourself a little chilled at night now that the season is changing to cooler evening temperatures...and what simple things can you do to warm up your body to a nice point of comfort.

Find a cozy organic cotton blanket that you can leave close to your couch or by your bed, so you can add another layer of warmth over your body without having to add a lot of extra weight with a huge synthetic fabric common to most blankets or throws.

Locate a soft and soothing sweater to slip on over what your wearing in the evenings or if you want to go out for a short jaunt after the sun has gone down without the heaviness of a coat or jacket.

Sip on a warm and wonderful cup of herb tea to warm your body gently from the interior! Ginger is warming and so is a spicy Chai with cinnamon and honey!

The Tea Farm

Mountain Rose Herbs


Food Poisoning - What Remedy Works Fast? :
10-7-2007

If you have ingested a little more than you expected to with your food and you find yourself the victim of food poisoning; then there are a few things you can do to help your body cope with the little "buggers" immediately!

Mix up to ten drops of Nutri-Biotic concentrate with pure water (approximately 6 oz.) and gargle, then swallow the mixture. This will help to kill any micro-organism that still lurks in your mouth and throat. It will then reach your stomach and continue to destroy the "critters" as it goes on through the digestive system.

You can repeat this process hourly until all signs of food poisoning have passed and no digestive or lymphatic discomfort remains.

GSE Information


If You Want Sweet Tasting Herbs to Clear the Lungs... :
10-6-2007

Yesterday, the savory way to "clear the Lungs" of heat was discussed. Today, we go back to the Lungs with a sweet solution. Many people prefer sweet flavors to savory tastes. In this case, to "clear the Lungs" it is time to call out the delicious Prince of Peace Honey Loquat Syrup.

Get Loquat Syrup Here


Lotus Root - Clear the Lungs :
10-5-2007

One of the rare secrets of Macrobiotics is the value of the unusual, seldom-seen Lotus Root! Most people have no idea what Lotus Root looks like - it's rather beautiful and the holes almost resemble petals. Fewer people yet know how to prepare Lotus Root!

The most advantageous way to derive all the health-promoting qualities of Lotus Root is to add it to a Miso broth with onion and garlic cloves and simmer for an hour until the sliced Lotus Root is softened and pliable. The health benefit: Clearing the Lungs! So...if you are around smoke or polluted air; if you eat bread, drink milk, or eat any fatty foods...Lotus Root is one unique food that will be a fantastic addition to your Food Plan.


Harvest Time - Time for Soup :
10-4-2007

Now that the Fall is bringing squash and pumpkin to their full ripeness, and the bounty of many vegetables are nearing their peak; it's Time for Soup.

This time of year allows us to make our own nutrient-rich broth of vegetable stock and root vegetables. Carrots, onions, potatoes, celery, cabbage, greens, garlic, and so many varieties of herbs are ready to give their best to your food preparations. This is the finest soup stock that is available!

Eat Soup - It's the Time of the Year to Strengthen Your Body with Healthy and Rich Vegetable Broths. Add squash, pumpkin, peas, beans, and any good thing that is ripe on the vine to your Soups.


Your Attitude Empowers the Healing Experience :
10-3-2007

Many people are uncertain what role the Mind plays in the Body/Mind/Spirit Connection relating to Health and Wellness. The most significant aspect of the Power of your Mind is your Attitude!

Attitude magnifies the core belief systems which are the foundation of your Personal Reality construct. In other words, you become what you believe to be true. If you think you are statistically more likely to get Cancer, because a relative had Cancer; then it is far more likely that you will manifest Cancer in your body. If you engage in healthy behavior, it changes the quantum field and in all probability, it is far more likely that you will be free from Cancer as a result of your intent.


Goji Berries Go On Oprah with Dr. Oz :
10-2-2007

Dr. Oz took Goji Berries to Oprah and addressed Men's Health Issues for an entire hour! Oprah watched with the other female guests while Dr. Oz took on some of the more delicate health concerns including aging, heart health, cancer, and even relationship issues. He spelled out "Goji Berries" when referring to foods rich in anti-oxidants.

Traditional Herbal medicine from Asia has used "goji" or "wolfberries" for centuries in formulations for nourishing Yin, and tonifying the energy of the Lung, Liver, and Kidney meridians. Different concoctions of the bark and leaf are used to reduce inflammatory conditions and to address aging.

It is advantageous to consume Goji Berries with other herbs and nutrient-dense whole foods, so we recommend NingXia Red - a tasty beverage made by Young Living.


Ice Cubes - Use the Best to Freeze Please :
10-1-2007

When you are making ice cubes for your beverages, try to remember to use only purified water to fill the ice cube trays. Do not consume ice from the ice cube maker or from restaurants unless they make their cubes with pure water.

Then again...here's a novel and unusual approach to icing down your drinks: Make your Shot Glass out of Ice! That's correct! You can use this new-fangled mold to form ice Shot Glasses which you then fill with any beverage of your choice!

If you want to increase the value of ice or ice shot glasses, try making them from an herbal tea or a juice. This unique method adds nutrients to the ice and flavor - a special bonus to make nice ice!

Dancing Worm Ice Molds


Terms of Service    Privacy Statement   Site Map   Contact Us  


©All Rights Reserved 2007, 2008 FreeHealthIdeas.com
'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>'; echo "\n"; ?>


> 'docreate') { if (!empty($group)) { $groupowner = fetch_userinfo($group['creatoruserid']); cache_permissions($groupowner); } else { $groupowner = $vbulletin->userinfo; } } // ####################################################################### if ($_REQUEST['do'] == 'create' OR $_REQUEST['do'] == 'docreate') { if (!($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['cancreategroups'])) { print_no_permission(); } if ($vbulletin->userinfo['permissions']['maximumsocialgroups']) { // fetch the number of groups the user has already created $result = $vbulletin->db->query_first( "SELECT COUNT(groupid) AS total FROM " . TABLE_PREFIX . "socialgroup WHERE creatoruserid = " . $vbulletin->userinfo['userid'] ); if ($result['total'] >= $vbulletin->userinfo['permissions']['maximumsocialgroups']) { standard_error(fetch_error((fetch_socialgroup_perm('candeleteowngroups') ? 'you_can_only_create_x_groups_delete' : 'you_can_only_create_x_groups'), $vbulletin->userinfo['permissions']['maximumsocialgroups'])); } } } // ####################################################################### if ($_POST['do'] == 'docreate') { if (!($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['cancreategroups'])) { print_no_permission(); } $vbulletin->input->clean_array_gpc('p', array( 'groupname' => TYPE_NOHTML, 'socialgroupcategoryid' => TYPE_UINT, 'groupdescription' => TYPE_NOHTML, 'grouptype' => TYPE_STR, 'options' => TYPE_ARRAY_BOOL, )); $groupdm =& datamanager_init('SocialGroup', $vbulletin, ERRTYPE_STANDARD); $groupdm->set('name', $vbulletin->GPC['groupname']); $groupdm->set('description', $vbulletin->GPC['groupdescription']); $groupdm->set('creatoruserid', $vbulletin->userinfo['userid']); $groupdm->set('type', $vbulletin->GPC['grouptype']); if (!$vbulletin->GPC['socialgroupcategoryid']) { $groupdm->error('must_select_a_category'); } $groupdm->set('socialgroupcategoryid', $vbulletin->GPC['socialgroupcategoryid']); foreach (array_keys($vbulletin->bf_misc_socialgroupoptions) AS $key) { switch ($key) { case 'owner_mod_queue': { $permcheck = ( $vbulletin->options['sg_allow_owner_mod_queue'] AND !$vbulletin->options['social_moderation'] AND $groupowner['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canmanageowngroups'] AND $vbulletin->options['socnet_groups_msg_enabled'] ) ? true : false; } break; case 'join_to_view': { $permcheck = ( $vbulletin->options['sg_allow_join_to_view'] AND ( $vbulletin->options['socnet_groups_msg_enabled'] OR $vbulletin->options['socnet_groups_albums_enabled'] ) ) ? true : false; } break; case 'enable_group_messages': { $permcheck = $vbulletin->options['socnet_groups_msg_enabled'] ? true : false; } break; case 'enable_group_albums': { $permcheck = $vbulletin->options['socnet_groups_albums_enabled'] ? true : false; } break; case 'only_owner_discussions': { $permcheck = ( $vbulletin->options['sg_enable_owner_only_discussions'] AND fetch_socialgroup_perm('canlimitdiscussion') ) ? true: false; } break; default: { $permcheck = false; } } $value = $permcheck ? isset($vbulletin->GPC['options']["$key"]) : false; $groupdm->set_bitfield('options', $key, $value); } ($hook = vBulletinHook::fetch_hook('group_docreate')) ? eval($hook) : false; $group = array('groupid' => $groupdm->save()); unset($groupdm); if ($vbulletin->options['sg_enablesocialgroupicons'] AND fetch_socialgroup_perm('canuploadgroupicon')) { $_REQUEST['do'] = 'edit'; $icononly = true; } else { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $groupid; eval(print_standard_redirect('successfully_created_group')); } } // ####################################################################### if ($_REQUEST['do'] == 'create' OR $_REQUEST['do'] == 'edit') { if (!$icononly) { switch($_REQUEST['do']) { case 'create': { $phrase = $vbphrase['create_group']; $action = 'docreate'; $checked['enable_group_messages'] = ' checked="checked"'; $checked['enable_group_albums'] = ' checked="checked"'; } break; case 'edit': { if (!can_edit_group($group)) { print_no_permission(); } $typeselected["$group[type]"] = ' selected="selected"'; $phrase = $vbphrase['edit_group']; $action = 'doedit'; $checked['enable_group_messages'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_messages']) ? ' checked="checked"' : ''; $checked['enable_group_albums'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums']) ? ' checked="checked"' : ''; $checked['mod_queue'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['owner_mod_queue']) ? ' checked="checked"' : ''; $checked['join_to_view'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) ? ' checked="checked"' : ''; $checked['only_owner_discussions'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['only_owner_discussions']) ? ' checked="checked"' : ''; } break; } // get category options $categories = fetch_socialgroup_category_options(); $categoryoptions = ''; foreach ($categories as $categoryid => $category) { $optiontitle = $category['title']; $optionvalue = $categoryid; $optionselected = ($categoryid == $group['socialgroupcategoryid'] ? ' selected="selected"' : ''); eval('$categoryoptions .= "' . fetch_template('option') . '";'); } unset($categories); if ($_REQUEST['do'] == 'edit') { $show['title'] = (can_moderate(0, 'caneditsocialgroups') OR $group['members'] <= 1); } else { $show['title'] = true; } $show['mod_queue'] = ( $vbulletin->options['sg_allow_owner_mod_queue'] AND !$vbulletin->options['social_moderation'] AND $groupowner['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canmanageowngroups'] AND $vbulletin->options['socnet_groups_msg_enabled'] ); $show['join_to_view'] = ( $vbulletin->options['sg_allow_join_to_view'] AND ( $vbulletin->options['socnet_groups_msg_enabled'] OR $vbulletin->options['socnet_groups_albums_enabled'] ) ); $show['enable_group_messages'] = $vbulletin->options['socnet_groups_msg_enabled']; $show['enable_group_albums'] = $vbulletin->options['socnet_groups_albums_enabled']; $show['only_owner_discussions'] = ( $vbulletin->options['sg_enable_owner_only_discussions'] AND $groupowner['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canlimitdiscussion'] ); if (!$show['only_owner_discussions']) { $checked['only_owner_discussions'] = (bool)($group['options'] & $vbulletin->bf_misc_socialgroupoptions['only_owner_discussions']); } $show['options'] = ($show['mod_queue'] OR $show['join_to_view'] OR $show['enable_group_albums'] OR $show['enable_group_messages'] OR $show['only_owner_discussions']); } else { $phrase = $vbphrase['create_group']; } // edit icon if (($_REQUEST['do'] == 'edit') AND $vbulletin->options['sg_enablesocialgroupicons'] AND fetch_socialgroup_perm('canuploadgroupicon')) { $show['editicon'] = true; $show['deleteicon'] = (bool)$group['icondateline']; ($hook = vBulletinHook::fetch_hook('group_edit_groupicon')) ? eval($hook) : false; $groupiconurl = fetch_socialgroupicon_url($group, true); if ($permissions['groupiconmaxsize']) { $maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_or_z'], FIXED_SIZE_GROUP_ICON_WIDTH, FIXED_SIZE_GROUP_ICON_HEIGHT, (($permissions['groupiconmaxsize'] / 1000) . $vbphrase['kilobytes'])); } else { $maxnote = construct_phrase($vbphrase['note_maximum_size_x_y_pixels'], FIXED_SIZE_GROUP_ICON_WIDTH, FIXED_SIZE_GROUP_ICON_HEIGHT); } $show['url_option'] = (ini_get('allow_url_fopen') != 0 OR function_exists('curl_init')); } // navbits $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'] ); if ($_REQUEST['do'] == 'edit') { $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid']] = $group['categoryname']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']] = $group['name']; } $navbits[''] = $phrase; $url = $vbulletin->url; $templatename = 'socialgroups_form'; } // ####################################################################### if ($_POST['do'] == 'doedit') { $vbulletin->input->clean_array_gpc('p', array( 'groupname' => TYPE_NOHTML, 'groupdescription' => TYPE_NOHTML, 'grouptype' => TYPE_STR, 'socialgroupcategoryid' => TYPE_UINT, 'options' => TYPE_ARRAY_BOOL, )); if (!can_edit_group($group)) { print_no_permission(); } $groupdm =& datamanager_init('SocialGroup', $vbulletin, ERRTYPE_STANDARD); $groupdm->set_existing($group); if (can_moderate(0, 'caneditsocialgroups') OR $group['members'] == 1) { $groupdm->set('name', $vbulletin->GPC['groupname']); } $groupdm->set('description', $vbulletin->GPC['groupdescription']); $groupdm->set('type', $vbulletin->GPC['grouptype']); if (!$vbulletin->GPC['socialgroupcategoryid']) { $groupdm->error('must_select_a_category'); } $groupdm->set('socialgroupcategoryid', $vbulletin->GPC['socialgroupcategoryid']); foreach (array_keys($vbulletin->bf_misc_socialgroupoptions) AS $key) { switch ($key) { case 'owner_mod_queue': { $permcheck = ( $vbulletin->options['sg_allow_owner_mod_queue'] AND !$vbulletin->options['social_moderation'] AND $groupowner['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canmanageowngroups'] AND $vbulletin->options['socnet_groups_msg_enabled'] ) ? true : false; } break; case 'join_to_view': { $permcheck = ( $vbulletin->options['sg_allow_join_to_view'] AND ( $vbulletin->options['socnet_groups_msg_enabled'] OR $vbulletin->options['socnet_groups_albums_enabled'] ) ) ? true : false; } break; case 'enable_group_messages': { $permcheck = $vbulletin->options['socnet_groups_msg_enabled'] ? true : false; } break; case 'enable_group_albums': { $permcheck = $vbulletin->options['socnet_groups_albums_enabled'] ? true : false; } break; case 'only_owner_discussions': { $permcheck = ( fetch_socialgroup_perm('canlimitdiscussion') ) ? true: false; } break; default: { $permcheck = false; } } $value = $permcheck ? isset($vbulletin->GPC['options']["$key"]) : false; $groupdm->set_bitfield('options', $key, $value); } ($hook = vBulletinHook::fetch_hook('group_doedit')) ? eval($hook) : false; $groupdm->save(); unset($groupdm); if (!$group['is_owner'] AND can_moderate(0, 'caneditsocialgroups')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($group, 'social_group_x_edited', array($group['name']) ); } eval(print_standard_redirect('successfully_edited_group')); } // ####################################################################### if ($_REQUEST['do'] == 'markread') { $vbulletin->input->clean_array_gpc('p', array( 'ajax' => TYPE_BOOL )); if ($discussion['discussionid']) { exec_sg_mark_as_read('discussion', $discussion['discussionid']); } else if ($group['groupid']) { exec_sg_mark_as_read('group', $group['groupid']); } if ($vbulletin->GPC['ajax']) { //print some xml require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('success', '1'); $xml->print_xml(); } else { $_REQUEST['do'] = 'view'; } } // ####################################################################### if ($_REQUEST['do'] == 'subscribe') { if (!$group['groupid']) { standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink'])); } if (!$vbulletin->userinfo['userid'] OR !$group['canviewcontent']) { print_no_permission(); } $vbulletin->input->clean_array_gpc('p', array( 'emailupdate' => TYPE_STR )); if (empty($_POST['do'])) { if ($discussion['discussionid']) { $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=discuss&discussionid=' . $discussion['discussionid'] => $discussion['title'], '' => $vbphrase['subscriptions'] ); $templatename = 'socialgroups_subscribe'; } else { $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['subscriptions'] ); $templatename = 'socialgroups_subscribe_group'; } } else { if ($discussion['discussionid']) { $emailupdate = ($vbulletin->GPC['emailupdate'] ? 1 : 0); /*insert query*/ $vbulletin->db->query_write(" REPLACE INTO " . TABLE_PREFIX . "subscribediscussion (userid, discussionid, emailupdate) VALUES (" . $vbulletin->userinfo['userid'] . ", " . $discussion['discussionid'] . ", $emailupdate) "); // mark discussion as having subscribers $vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "discussion AS discussion SET subscribers = '1' WHERE discussion.discussionid = " . $discussion['discussionid'] ); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=discuss&discussionid=' . $discussion['discussionid']; eval(print_standard_redirect('redirect_subsadd_discussion', true, true)); } else { switch ($vbulletin->GPC['emailupdate']) { case 'weekly': case 'daily': $emailupdate = $vbulletin->GPC['emailupdate']; break; case 'none': default: $emailupdate = 'none'; } /*insert query*/ $db->query_write(" REPLACE INTO " . TABLE_PREFIX . "subscribegroup (userid, groupid, emailupdate) VALUES (" . $vbulletin->userinfo['userid'] . ", " . $group['groupid'] . ", '" . $db->escape_string($emailupdate) . "') "); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; eval(print_standard_redirect('redirect_subsadd_group', true, true)); } } } // ####################################################################### if ($_REQUEST['do'] == 'unsubscribe') { $vbulletin->input->clean_array_gpc('r', array( 'auth' => TYPE_STR, 'subscriptionid' => TYPE_UINT )); // check link in email if ($vbulletin->GPC['subscriptionid']) { $table = TABLE_PREFIX . 'subscribediscussion'; if ($subscription = $db->query_first_slave(" SELECT subscribediscussionid, discussionid FROM $table INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = $table.userid) WHERE $table.subscribediscussionid = " . $vbulletin->GPC['subscriptionid'] . " AND MD5(CONCAT(user.userid, $table.subscribediscussionid, user.salt, '" . COOKIE_SALT . "')) = '" . $db->escape_string($vbulletin->GPC['auth']) . "' ")) { $db->query_write(" DELETE FROM $table WHERE $table.subscribediscussionid = " . $vbulletin->GPC['subscriptionid'] . " "); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=discuss&discussionid=' . $subscription['discussionid']; eval(print_standard_redirect('redirect_subsremove_discussion', true, true)); } } // check group if (!$group['groupid']) { standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink'])); } if ($discussion['discussionid']) { $table = TABLE_PREFIX . 'subscribediscussion'; $vbulletin->db->query_write(" DELETE FROM $table WHERE $table.userid = ". $vbulletin->userinfo['userid'] . " AND $table.discussionid = " . $discussion['discussionid'] ); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=discuss&discussionid=' . $discussion['discussionid']; eval(print_standard_redirect('redirect_subsremove_discussion', true, true)); } else { $table = TABLE_PREFIX . 'subscribegroup'; $vbulletin->db->query_write(" DELETE FROM $table WHERE $table.userid = ". $vbulletin->userinfo['userid'] . " AND $table.groupid = " . $group['groupid'] ); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; eval(print_standard_redirect('redirect_subsremove_group', true, true)); } } // ####################################################################### if ($_REQUEST['do'] == 'view' OR $_REQUEST['do'] == 'discuss' OR $_REQUEST['do'] == 'message') { $vbulletin->input->clean_array_gpc('r', array( 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'showignored' => TYPE_BOOL, 'searchtext' => TYPE_NOHTML )); $grouptypephrase = $vbphrase['group_desc_' . $group['type']]; // Get group options $show['groupoptions'] = false; $groupoptions = fetch_groupoptions($group, $show['groupoptions']); } // ####################################################################### if ($_REQUEST['do'] == 'view') { $show['groupinfo'] = (!$vbulletin->GPC['pagenumber'] AND !$vbulletin->GPC['perpage'] AND !$vbulletin->GPC['searchtext']); if ($show['groupinfo']) { // first page -- main group page $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], '' => $group['name'] ); } else { $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid=$group[groupid]" => $group['name'], '' => $vbphrase['group_discussions'] ); } if ($show['groupinfo']) { // Show group icon $groupiconurl = fetch_socialgroupicon_url($group); // Show members $groupmemberids = $vbulletin->db->query_read_slave(" SELECT userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid " . ($vbulletin->options['avatarenabled'] ? ', avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, customavatar.width as avwidth, customavatar.height as avheight, customavatar.filedata_thumb' : '') . ', customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight' . ", user.icq AS icq, user.aim AS aim, user.yahoo AS yahoo, user.msn AS msn, user.skype AS skype FROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroupmember.userid) LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (user.userid = userfield.userid) LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) " . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON (customavatar.userid = user.userid) " : '') . "LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) " . "WHERE socialgroupmember.groupid = " . $group['groupid'] . " AND socialgroupmember.type = 'member' ORDER BY user.lastactivity DESC LIMIT 10 "); $members_shown = $vbulletin->db->num_rows($groupmemberids); while ($groupmember = $vbulletin->db->fetch_array($groupmemberids)) { $width = 0; $height = 0; fetch_avatar_from_userinfo($groupmember, true); fetch_musername($groupmember); $user = $groupmember; ($hook = vBulletinHook::fetch_hook('group_memberbit')) ? eval($hook) : false; eval('$short_member_list_bits .= "' . fetch_template('memberinfo_tiny') .'";'); } $vbulletin->db->free_result($groupmemberids); // find recent pictures $show['pictures_block'] = ( $group['canviewcontent'] AND $group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'] AND $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] AND ( $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['socnet_groups_albums_enabled'] ) ); ($hook = vBulletinHook::fetch_hook('group_view_pictures_start')) ? eval($hook) : false; if ($show['pictures_block']) { $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('group_pictures_query')) ? eval($hook) : false; $pictures_sql = $db->query_read_slave(" SELECT picture.pictureid, picture.userid, picture.caption, picture.extension, picture.filesize, picture.idhash, picture.thumbnail_filesize, picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height, socialgrouppicture.dateline, user.username $hook_query_fields FROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture INNER JOIN " . TABLE_PREFIX . "picture AS picture ON (picture.pictureid = socialgrouppicture.pictureid) INNER JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = picture.userid AND socialgroupmember.groupid = $group[groupid] AND socialgroupmember.type = 'member') LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = picture.userid) $hook_query_joins WHERE socialgrouppicture.groupid = $group[groupid] $hook_query_where ORDER BY socialgrouppicture.dateline DESC LIMIT 5 "); // work out the effective picturebit height/width including any borders and paddings; the +4 works around an IE float issue $picturebit_height = $vbulletin->options['album_thumbsize'] + (($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding']) * 2 + 4; $picturebit_width = $vbulletin->options['album_thumbsize'] + (($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding']) * 2; $pictures_shown = vb_number_format($db->num_rows($pictures_sql)); $picturebits = ''; while ($picture = $db->fetch_array($pictures_sql)) { $picture = prepare_pictureinfo_thumb($picture, $group); ($hook = vBulletinHook::fetch_hook('group_picturebit')) ? eval($hook) : false; eval('$picturebits .= "' . fetch_template('socialgroups_picturebit') . '";'); } $db->free_result($pictures_sql); $show['add_pictures_link'] = ($group['membertype'] == 'member' AND $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']); $show['pictures_block'] = ($show['add_pictures_link'] OR $picturebits OR $group['picturecount']); } } // Display discussions $show['groupdiscussions'] = $show['quickcomment'] = ($vbulletin->options['socnet_groups_msg_enabled'] AND $group['canviewcontent'] AND ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_messages'])); ($hook = vBulletinHook::fetch_hook('group_view_discussion_start')) ? eval($hook) : false; if ($show['groupdiscussions']) { // get sorting $vbulletin->input->clean_array_gpc('r', array( 'sort' => TYPE_NOHTML, 'order' => TYPE_NOHTML )); $desc = ('asc' == $vbulletin->GPC['order']) ? false : true; $sortfield = $vbulletin->GPC['sort']; $searchtext = $vbulletin->GPC['searchtext']; // show auto moderation message $show['auto_moderation'] = fetch_group_auto_moderation($group); // show subscribe link $show['subscribe'] = (bool)$vbulletin->userinfo['userid']; // Items to display per page $perpage = (!$vbulletin->GPC['perpage'] OR $vbulletin->GPC['perpage'] > $vbulletin->options['sgd_maxperpage']) ? $vbulletin->options['sgd_perpage'] : $vbulletin->GPC['perpage']; // Create discussion collection require_once(DIR . '/includes/class_groupmessage.php'); $collection_factory = new vB_Group_Collection_Factory($vbulletin, $group); $collection = $collection_factory->create('discussion', $group['groupid'], $vbulletin->GPC['pagenumber'], $perpage, $desc); $collection->filter_sort_field($sortfield); $collection->filter_searchtext($searchtext); if (!$vbulletin->options['threadmarking'] OR !$vbulletin->userinfo['userid']) { $collection->check_read(false); } // Set counts for view list($messagestart, $messageend, $messageshown, $messagetotal) = array_values($collection->fetch_counts()); // Get actual resolved page number in case input was normalised $pagenumber = $collection->fetch_pagenumber(); // Create bit factory $factory = new vB_Group_Bit_Factory($vbulletin, 'discussion'); // Build message bits for all items $messagebits = ''; while ($item = $collection->fetch_item()) { $bit =& $factory->create($item, $group); $messagebits .= $bit->construct(); } unset($factory, $bit); // Get last item's dateline $lastcomment = $collection->fetch_lastitem('dateline'); unset($collection_factory, $collection); // Construct page navigation $pagenavbits = array("groupid={$group['groupid']}"); if ($sortfield) { $pagenavbits[] = "sort=" . urlencode($sortfield); } if (!$desc) { $pagenavbits[] = "order=asc"; } if ($searchtext) { $pagenavbits[] = "searchtext=" . urlencode($searchtext); } $pagenav = fetch_group_pagenav($pagenumber, $perpage, $messagetotal, $pagenavbits); // Sort helpers $oppositesort = $desc ? 'asc' : 'desc'; $sorturl = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid=$group[groupid]" . ($searchtext ? "&searchtext=" . urlencode($searchtext) : ''); $orderlinks = array( 'replies' => $sorturl . '&sort=replies' . ($sortfield == 'replies' ? '&order=' . $oppositesort : ''), 'dateline' => $sorturl . '&sort=dateline' . ($sortfield == 'dateline' ? '&order=' . $oppositesort : ''), 'lastpost' => $sorturl . '&sort=lastpost' . ($sortfield == 'lastpost' ? '&order=' . $oppositesort : '') ); eval('$sortarrow["$sortfield"] = "' . fetch_template('forumdisplay_sortarrow') . '";'); // Inline moderation options show_group_inlinemoderation($group, $show, true); } $ownerlink = 'member.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $group['creatoruserid']; $show['postlink'] = (can_post_new_discussion($group)); // Set page template $templatename = 'socialgroups_group'; } // ####################################################################### // View messages in a discussion if ($_REQUEST['do'] == 'discuss') { require_once(DIR . '/includes/class_groupmessage.php'); // Check if user can view messages in this discussion if (empty($discussion) OR !$vbulletin->options['socnet_groups_msg_enabled'] OR !$group['canviewcontent'] OR !($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_messages'])) { standard_error(fetch_error('invalidid', $vbphrase['social_group_discussion'], $vbulletin->options['contactuslink'])); } // Navbits for breadcrumb $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $discussion['title'] ); ($hook = vBulletinHook::fetch_hook('group_discuss_start')) ? eval($hook) : false; // Show auto moderation message $show['auto_moderation'] = fetch_group_auto_moderation($group); // Items to display per page $perpage = (!$vbulletin->GPC['perpage'] OR $vbulletin->GPC['perpage'] > $vbulletin->options['gm_maxperpage']) ? $vbulletin->options['gm_perpage'] : $vbulletin->GPC['perpage']; // Create message collection $collection_factory = new vB_Group_Collection_Factory($vbulletin, $group); $collection = $collection_factory->create('message', $discussion['discussionid'], $vbulletin->GPC['pagenumber'], $perpage, false); // If a message is specified, seek to the results page with the message if ($messageinfo['gmid']) { $collection->seek_item($goto = $messageinfo['dateline']); } else if ($goto = $vbulletin->input->clean_gpc('r', 'goto', TYPE_UINT)) { $collection->seek_item($goto); } // Set counts for view list($messagestart, $messageend, $messageshown, $messagetotal) = array_values($collection->fetch_counts()); // Get actual resolved page number in case input was normalised $pagenumber = $show['pagenumber'] = $collection->fetch_pagenumber(); $quantity = $collection->fetch_quantity(); // Create bit factory $bitfactory = new vB_Group_Bit_Factory($vbulletin, 'message'); // Get first item $firstrecord =& $collection->fetch_firstitem(); // Build message bits for all items $messagebits = ''; while ($item = $collection->fetch_item()) { if ($goto) { // mark first item after requested dateline if ($item['dateline'] >= $goto) { $item['goto'] = true; $goto = false; } } $bit =& $bitfactory->create($item, $group); $messagebits .= $bit->construct(); } unset($bitfactory, $bit); // Get last item's dateline $lastcomment = $collection->fetch_lastitem('dateline'); unset($collection_factory, $collection); // Only allow AJAX QC on the last page $show['quickcomment'] = (can_post_new_message($group)); if ($messageend >= $messagetotal) { $show['allow_ajax_qc'] = 1; // also mark discussion as read exec_sg_mark_as_read('discussion', $discussion['discussionid']); } if ($show['quickcomment']) { require_once(DIR . '/includes/functions_editor.php'); $stylevar['messagewidth'] = $stylevar['messagewidth_usercp']; $editorid = construct_edit_toolbar( '', false, 'groupmessage', $vbulletin->options['allowsmilies'], true, false, 'qr_small' ); } // Construct page navigation $pagenavbits = array('do=discuss', "discussionid={$discussion['discussionid']}"); $pagenav = fetch_group_pagenav($pagenumber, $perpage, $messagetotal, $pagenavbits); // Display inline moderation if ($show['inlinemod']) { show_group_inlinemoderation($group, $show, false); } $show['postlink'] = (can_post_new_message($group)); $show['subscribe'] = (bool)$vbulletin->userinfo['userid']; // Social bookmarking if ($vbulletin->options['socialbookmarks']) { $guestuser = array( 'userid' => 0, 'usergroupid' => 0, ); cache_permissions($guestuser); $bookmarksites = ''; if ( is_array($vbulletin->bookmarksitecache) AND !empty($vbulletin->bookmarksitecache) AND $guestuser['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview'] AND $guestuser['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'] AND !(($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) OR !$vbulletin->options['sg_allow_join_to_view']) ) { foreach ($vbulletin->bookmarksitecache AS $bookmarksite) { $bookmarksite['link'] = str_replace( array('{URL}', '{TITLE}'), array(urlencode($vbulletin->options['bburl'] . '/group.php?discussionid=' . $discussion['discussionid']), urlencode(($bookmarksite['utf8encode'])?utf8_encode($discussion['title']):$discussion['title'])), $bookmarksite['url'] ); ($hook = vBulletinHook::fetch_hook('showthread_bookmarkbit')) ? eval($hook) : false; eval('$bookmarksites .= "' . fetch_template('showthread_bookmarksite') . '";'); } } } ($hook = vBulletinHook::fetch_hook('group_discuss_end')) ? eval($hook) : false; // Set page template $templatename = 'socialgroups_discussionview'; } // ####################################################################### if ($_REQUEST['do'] == 'view' OR $_REQUEST['do'] == 'discuss' OR $_REQUEST['do'] == 'grouplist' OR $_REQUEST['do'] == 'subscribe' OR $_REQUEST['do'] == 'overview' OR $_REQUEST['do'] == 'moderatedgms' OR $_REQUEST['do'] == 'requests' OR $_REQUEST['do'] == 'invitations') { $ownerlink = 'member.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $group['creatoruserid']; eval('$socialgroups_css = "' . fetch_template('socialgroups_css') . '";'); } // ####################################################################### if ($_REQUEST['do'] == 'viewmembers') { $vbulletin->input->clean_array_gpc('r', array( 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, )); $perpage = $vbulletin->GPC['perpage']; $pagenumber = $vbulletin->GPC['pagenumber']; $totalmembers = $group['members']; sanitize_pageresults($totalmembers, $pagenumber, $perpage); $groupmembers = $vbulletin->db->query_read_slave(" SELECT userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, " . ($vbulletin->options['avatarenabled'] ? 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight,' : '') . " customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight, user.icq AS icq, user.aim AS aim, user.yahoo AS yahoo, user.msn AS msn, user.skype AS skype FROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroupmember.userid) LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (user.userid = userfield.userid) LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) " . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON (customavatar.userid = user.userid) " : '') . " LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) WHERE socialgroupmember.groupid = " . $vbulletin->GPC['groupid'] . " AND socialgroupmember.type = 'member' ORDER BY user.username LIMIT " . (($pagenumber - 1) * $perpage) . ", $perpage "); require_once(DIR . '/includes/functions_bigthree.php'); while ($groupmember = $vbulletin->db->fetch_array($groupmembers)) { $width = 0; $height = 0; $alt = exec_switch_bg(); fetch_avatar_from_userinfo($groupmember, true); fetch_musername($groupmember); $user = $groupmember; fetch_online_status($user, true); construct_im_icons($user, true); ($hook = vBulletinHook::fetch_hook('group_memberbit')) ? eval($hook) : false; eval('$member_list .= "' . fetch_template('memberinfo_small') .'";'); } $vbulletin->db->free_result($groupmembersegoryid'] => $group['categoryname'], 'group.php?'. $vbulletin->session->vars['sessionurl'] .'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['member_list'] ); $custompagetitle = $group['name'] . ' - ' . $vbphrase['member_list']; $pagenav = construct_page_nav($pagenumber, $perpage, $totalmembers, 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=viewmembers&groupid=' . $group['groupid'] . ($perpage ? "&pp=$perpage" : '') ); eval('$memberinfo_css = "' . fetch_template('memberinfo_css') . '";'); $tep.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], '' => $vbphrase['advanced_search'] ); $categories = fetch_socialgroup_category_options(false, true); $category_options = ''; foreach ($categories AS $category) { $optionvalue = $category['socialgroupcategoryid']; $optionselected = ''; $optiontitle = $category['title']; eval('$category_options .= "' . fetch_template('option') . '";'); } unset($categories); $teupcategoryid']; $optionselected = ''; $optiontitle = $category['title']; eval('$category_options .= "' . fetch_template('option') . '";'); } unset($categories); $tealue = $category['socialgroupcategoryid']; $optionselected = ''; $optiontitle = $category['title']; eval('$category_options .= "' . fetch_template('option') . '";'); } unset($categories); $templatename = 'socialgroups_search'; } // ####################################################################### if ($_REQUEST['do'] == 'message') { $vbulletin->input->clean_array_gpc('r', array( 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, )); $perpage = $vbulletin->GPC['perpage']; $pagenumber = $vbulletin->GPC['pagenumber']; if (!$vbulletin->options['socnet_groups_msg_enabled']) { print_no_permission(); } if (empty($group)) { standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink'])); } // Check if we're posting or editing a discussion $edit_discussion = (empty($discussion) OR (!empty($messageinfo) AND $discussion['firstpostid'] == $messageinfo['gmid'])); if ($edit_discussion) { // editing or posting a new discussion if (!empty($messageinfo)) { // check if we are allowed to edit title $edit_discussion = can_edit_group_discussion($discussion, $group); if (!$edit_discussion AND !can_edit_group_message($messageinfo, $group)) { print_no_permission(); } } else { // check if we can post a new discussion in this group if (!can_post_new_discussion($group)) { if (!$group['membertype'] AND fetch_socialgroup_perm('cancreatediscussion')) { standard_error(fetch_error('must_be_group_member')); } standard_error(fetch_error('invalidid', $vbphrase['social_group_discussion'], $vbulletin->options['contactuslink'])); } } } else { // editing or posting a new message if (empty($discussion)) { standard_error(fetch_error('invalidid', $vbphrase['social_group_discussion'], $vbulletin->options['contactuslink'])); } // editing a message if ($messageinfo) { // Can we edit? if (!can_edit_group_message($messageinfo, $group)) { print_no_permission(); } } else { // posting a new message if (!can_post_new_message($group)) { print_no_permission(); } } } if ($_POST['do'] == 'message') { $vbulletin->input->clean_array_gpc('p', array( 'subject' => TYPE_STR, 'message' => TYPE_STR, 'wysiwyg' => TYPE_BOOL, 'disablesmilies' => TYPE_BOOL, 'parseurl' => TYPE_BOOL, 'username' => TYPE_STR, 'ajax' => TYPE_BOOL, 'lastcomment' => TYPE_UINT, 'humanverify' => TYPE_ARRAY, 'loggedinuser' => TYPE_UINT, 'fromquickcomment' => TYPE_BOOL, 'preview' => TYPE_STR, 'advanced' => TYPE_BOOL, 'hideinlinemod' => TYPE_BOOL )); ($hook = vBulletinHook::fetch_hook('group_message_post_start')) ? eval($hook) : false; // unwysiwygify the incoming data if ($vbulletin->GPC['wysiwyg']) { require_once(DIR . '/includes/functions_wysiwyg.php'); $vbulletin->GPC['message'] = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $vbulletin->options['allowhtml']); } // parse URLs in message text if ($vbulletin->options['allowbbcode'] AND $vbulletin->GPC['parseurl']) { require_once(DIR . '/includes/functions_newpost.php'); $vbulletin->GPC['message'] = convert_url_to_bbcode($vbulletin->GPC['message']); } $message = array( 'message' =>& $vbulletin->GPC['message'], 'postuserid' =>& $vbulletin->userinfo['userid'], 'disablesmilies' =>& $vbulletin->GPC['disablesmilies'], 'parseurl' =>& $vbulletin->GPC['parseurl'], ); if ($discussion['discussionid']) { $message['discussionid'] = $discussion['discussionid']; } if ($edit_discussion AND !$vbulletin->GPC['ajax']) { $message['title'] = $vbulletin->GPC['subject']; } if ($vbulletin->GPC['ajax']) { $message['message'] = convert_urlencoded_unicode($message['message']); } $dataman =& datamanager_init('GroupMessage', $vbulletin, ERRTYPE_ARRAY); $dataman->set_info('group', $group); $dataman->set_info('discussion', $discussion); if ($messageinfo) { // existing message $show['edit'] = true; $dataman->set_existing($messageinfo); } else { // New message if (fetch_group_auto_moderation($group)) { $dataman->set('state', 'moderation'); } if ($vbulletin->userinfo['userid'] == 0) { $dataman->setr('username', $vbulletin->GPC['username']); } $dataman->setr('discussionid', $message['discussionid']); $dataman->setr('postuserid', $message['postuserid']); } if ($edit_discussion) { $dataman->setr('title', $message['title']); } $message['pagetext'] = $message['message']; $message['postusername'] = $vbulletin->userinfo['username']; $dataman->set_info('preview', $vbulletin->GPC['preview']); $dataman->setr('pagetext', $message['pagetext']); $dataman->set('allowsmilie', !$message['disablesmilies']); $dataman->pre_save(); if ($vbulletin->GPC['fromquickcomment'] AND $vbulletin->GPC['preview']) { $dataman->errors = array(); } // Visitor Messages and Group Messages share the same restrictive bbcode set because of this... require_once(DIR . '/includes/class_socialmessageparser.php'); $pmparser = new vB_GroupMessageParser($vbulletin, fetch_tag_list()); $pmparser->parse($message['message']); if ($error_num = count($pmparser->errors)) { foreach ($pmparser->errors AS $tag => $error_phrase) { $dataman->errors[] = fetch_error($error_phrase, $tag); } } if (!empty($dataman->errors)) { if ($vbulletin->GPC['ajax']) { require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('errors'); foreach ($dataman->errors AS $error) { $xml->add_tag('error', $error); } $xml->close_group(); $xml->print_xml(); } else { define('MESSAGEPREVIEW', true); require_once(DIR . '/includes/functions_newpost.php'); $preview = construct_errors($dataman->errors); $_GET['do'] = 'message'; } } else if ($vbulletin->GPC['preview'] OR $vbulletin->GPC['advanced']) { define('MESSAGEPREVIEW', true); $preview = process_group_message_preview($message); $_GET['do'] = 'message'; } else { $gmid = $dataman->save(); if ($messageinfo) { $gmid = $messageinfo['gmid']; } if ($messageinfo AND !$group['is_owner'] AND can_moderate(0, 'caneditgroupmessages')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($messageinfo, 'gm_by_x_in_y_for_z_edited', array($messageinfo['postusername'], $discussion['title'], $group['name']) ); } if ($vbulletin->GPC['ajax'] AND (!$edit_discussion OR $messageinfo['gmid'])) { require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('commentbits'); require_once(DIR . '/includes/class_groupmessage.php'); // create message collection $collection_factory = new vB_Group_Collection_Factory($vbulletin, $group); $collection = $collection_factory->create( ($messageinfo['gmid'] ? 'message' : 'recentmessage'), $discussion['discussionid'], false, false, false, true ); if ($messageinfo['gmid']) { $collection->filter_id($messageinfo['gmid']); } else { $collection->set_dateline($vbulletin->GPC['lastcomment'], $gmid); } // add hook for manipulating query $collection->set_query_hook('group_message_post_ajax'); // create bit factory for rendering messages $bitfactory = new vB_Group_Bit_Factory($vbulletin, 'message'); // build response for each message while ($message = $collection->fetch_item()) { $bit = $bitfactory->create($message, $group); if ($vbulletin->GPC['hideinlinemod']) { $bit->show_moderation_tools(false); } $xml->add_tag('message', process_replacement_vars($bit->construct()), array( 'gmid' => $message['gmid'], 'visible' => ($message['state'] == 'visible') ? 1 : 0, 'bgclass' => $bgclass, 'quickedit' => 1 )); } unset($bitfactory, $bit, $collection_factory, $collection); exec_sg_mark_as_read('discussion', $discussion['discussionid'], $vbulletin->userinfo['username']); // send notifications if (!$messageinfo AND $discussion['subscribers'] AND !fetch_group_auto_moderation($group)) { exec_send_sg_notification($discussion['discussionid'], $gmid, $postusername=false); } $xml->add_tag('time', TIMENOW); $xml->close_group(); $xml->print_xml(true); } else { // check if we're posting a new discussion if (!$messageinfo AND $edit_discussion) { // create a new discussion using the new message as the first and last posts $discussion_dm =& datamanager_init('Discussion', $vbulletin, ERRTYPE_ARRAY); $discussion_dm->set('groupid', $group['groupid']); $discussion_dm->set('firstpostid', $gmid); $discussion_dm->set('lastpost', TIMENOW); $discussion_dm->set('lastpostid', $gmid); $discussion_dm->set('lastposter', $vbulletin->userinfo['username']); $discussion_dm->set('lastposterid', $vbulletin->userinfo['userid']); $discussion_dm->set_info('lastposttitle', $message['title']); // set group info so discussion dm can update counters on group $discussion_dm->setr_info('group', $group); // set the relevant counter to 1 based on new messages state $discussion_dm->set($dataman->fetch_field('state'), 1); $discussionid = $discussion_dm->save(); unset($discussion_dm); if (!fetch_group_auto_moderation($group)) { exec_sg_mark_as_read('discussion', $discussionid); } // IIS may have issues setting cookies with header redirects $forceredirect = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false); ($hook = vBulletinHook::fetch_hook('group_message_post_complete')) ? eval($hook) : false; $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "&do=discuss&groupid=$group[groupid]&discussionid=$discussion[discussionid]&gmid=$gmid#gmessage$gmid"; eval(print_standard_redirect('visitormessagethanks', true, $forceredirect)); } else { // mark discussion as read exec_sg_mark_as_read('discussion', $discussion['discussionid']); // IIS may have issues setting cookies with header redirects $forceredirect = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false); ($hook = vBulletinHook::fetch_hook('group_message_post_complete')) ? eval($hook) : false; $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "&do=discuss&groupid=$group[groupid]&discussionid=$discussion[discussionid]&gmid=$gmid#gmessage$gmid"; // send notifications if (!$messageinfo AND !$edit_discussion AND $discussion['subscribers']) { exec_send_sg_notification($discussion['discussionid'], $gmid, $postusername=false); } eval(print_standard_redirect('visitormessagethanks', true, $forceredirect)); } } } unset($dataman); } if ($_GET['do'] == 'message') { require_once(DIR . '/includes/functions_editor.php'); ($hook = vBulletinHook::fetch_hook('group_message_form_start')) ? eval($hook) : false; if (defined('MESSAGEPREVIEW')) { $postpreview = $preview; $message['message'] = htmlspecialchars_uni($message['message']); require_once(DIR . '/includes/functions_newpost.php'); construct_checkboxes($message); } else if ($messageinfo) { require_once(DIR . '/includes/functions_newpost.php'); construct_checkboxes( array( 'disablesmilies' => (!$messageinfo['allowsmilie']), 'parseurl' => 1, ) ); $message['message'] = htmlspecialchars_uni($messageinfo['pagetext']); if ($edit_discussion) { $message['title'] = htmlspecialchars_uni($messageinfo['title']); } } else { $message['message'] = ''; } $navbits['group.php?' . $vbulletin->session->vars['sessionurl']] = $vbphrase['social_groups']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid']] = $group['categoryname']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid=$group[groupid]"] = $group['name']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . "do=discuss&discussionid=$discussion[discussionid]"] = $discussion['title']; if ($messageinfo) { $show['edit'] = true; if ($messageinfo['gmid'] == $discussion['firstpostid']) { $show['delete'] = ( fetch_socialgroup_modperm('candeletediscussions', $group) OR ( $messageinfo['postuserid'] == $vbulletin->userinfo['userid'] AND (( fetch_socialgroup_perm('canmanagediscussions') ) OR ( fetch_socialgroup_perm('canmanagemessages') AND can_edit_group_discussion($discussion) )) ) ); $show['physicaldeleteoption'] = fetch_socialgroup_modperm('canremovediscussions', $group); $delete_discussion = true; } else { $show['delete'] = ( fetch_socialgroup_modperm('candeletegroupmessages', $group) OR ( $messageinfo['postuserid'] == $vbulletin->userinfo['userid'] AND $messageinfo['gmid'] != $discussion['firstpostid'] AND fetch_socialgroup_perm('canmanagemessages') ) ); $show['physicaldeleteoption'] = fetch_socialgroup_modperm('canremovegroupmessages', $group); } $navbits[] = ($edit_discussion) ? $vbphrase['edit_discussion'] : $vbphrase['edit_message']; } else { $navbits[] = ($edit_discussion) ? $vbphrase['post_new_discussion'] : $vbphrase['reply_to_discussion']; } $istyles_js = construct_editor_styles_js(); $editorid = construct_edit_toolbar( $message['message'], false, 'groupmessage', $vbulletin->options['allowsmilies'], true, false ); eval('$usernamecode = "' . fetch_template('newpost_usernamecode') . '";'); // carry page number in case we do a hard delete $pagenumber = $vbulletin->input->clean_gpc('g', 'pagenumber', TYPE_UINT); // auto-parse URL if (!isset($checked['parseurl'])) { $checked['parseurl'] = 'checked="checked"'; } $show['parseurl'] = $vbulletin->options['allowbbcode']; $show['misc_options'] = ($show['parseurl'] OR !empty($disablesmiliesoption)); $show['additional_options'] = ($show['misc_options'] OR !empty($attachmentoption)); $show['auto_moderation'] = fetch_group_auto_moderation($group); $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); ($hook = vBulletinHook::fetch_hook('group_message_form_complete')) ? eval($hook) : false; // complete eval('print_output("' . fetch_template('socialgroups_editor') . '");'); } } // ####################################################################### if ($_POST['do'] == 'deletemessage') { $vbulletin->input->clean_array_gpc('p', array( 'deletemessage' => TYPE_STR, 'reason' => TYPE_STR, )); $vbulletin->input->clean_array_gpc('r', array( 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, )); // check if cancelled / no delete if ($vbulletin->GPC['deletemessage'] == '') { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "do=discuss&discussionid=$discussion[discussionid]"; eval(print_standard_redirect('redirect_groupmessage_nodelete')); } $is_discussion = ($discussion['firstpostid'] == $messageinfo['gmid']); $hard_delete = ($vbulletin->GPC['deletemessage'] == 'remove'); // Check permissions if ($is_discussion) { if ($messageinfo['state'] == 'deleted' AND !fetch_socialgroup_modperm('canundeletediscussions', $group)) { standard_error(fetch_error('you_do_not_have_permission_to_manage_deleted_discussions')); } else if ($messageinfo['state'] == 'moderation' AND !fetch_socialgroup_modperm('canmoderatediscussions', $group) AND (($messageinfo['postuserid'] != $vbulletin->userinfo['userid']) OR (!fetch_socialgroup_perm('canmanagediscussions')))) { standard_error(fetch_error('you_do_not_have_permission_to_manage_moderated_discussions')); } if ($hard_delete AND !fetch_socialgroup_modperm('canremovediscussions', $group)) { standard_error(fetch_error('you_do_not_have_permission_to_hard_delete_discussions')); } else if (!$hard_delete AND !fetch_socialgroup_modperm('candeletediscussions', $group) AND (($messageinfo['postuserid'] != $vbulletin->userinfo['userid']) OR (!fetch_socialgroup_perm('canmanagediscussions') AND (!fetch_socialgroup_perm('canmanagemessages') OR ($discussion['visible'] + $discussion['moderation'] + $discussion['deleted']) > 1)))) { standard_error(fetch_error('you_do_not_have_permission_to_soft_delete_discussions')); } } else { if ($messageinfo['state'] == 'deleted' AND !fetch_socialgroup_modperm('canundeletegroupmessages', $group)) { standard_error(fetch_error('you_do_not_have_permission_to_manage_deleted_messages')); } else if ($messageinfo['state'] == 'moderation' AND !fetch_socialgroup_modperm('canmoderategroupmessages', $group)) { standard_error(fetch_error('you_do_not_have_permission_to_manage_moderated_messages')); } if ($hard_delete AND !fetch_socialgroup_modperm('canremovegroupmessages', $group)) { standard_error(fetch_error('you_do_not_have_permission_to_hard_delete_messages')); } else if (!$hard_delete AND !fetch_socialgroup_modperm('candeletegroupmessages', $group) AND (($messageinfo['postuserid'] != $vbulletin->userinfo['userid']) OR !fetch_socialgroup_perm('canmanagemessages'))) { standard_error(fetch_error('you_do_not_have_permission_to_soft_delete_messages')); } } // Only specifically delete discussion on hard delete $delete_discussion = ($is_discussion AND $hard_delete); if ($delete_discussion) { // hard delete discussion, all messages, deletionlogs and moderation $dataman =& datamanager_init('Discussion', $vbulletin, ERRTYPE_STANDARD); $dataman->set_existing($discussion); $dataman->set_info('group', $group); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "do=view&groupid=$group[groupid]"; } else { // soft delete message $dataman =& datamanager_init('GroupMessage', $vbulletin, ERRTYPE_STANDARD); $dataman->set_existing($messageinfo); $dataman->set_info('hard_delete', $hard_delete); $dataman->set_info('reason', $vbulletin->GPC['reason']); $dataman->set_info('group', $group); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "do=discuss&discussionid=$discussion[discussionid]"; } ($hook = vBulletinHook::fetch_hook('group_message_delete')) ? eval($hook) : false; $dataman->delete(); unset($dataman); // Only log if not owner and not normally managing own messages if (!$group['is_owner'] AND (($messageinfo['postuserid'] != $vbulletin->userinfo['userid']) OR ($is_discussion AND $discussion['visible'] > 1))) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($messageinfo, ($hard_delete ? ($delete_discussion ? 'discussion_by_x_for_y_removed' : 'gm_by_x_for_y_removed') : 'gm_by_x_for_y_soft_deleted'), array($messageinfo['postusername'], $group['name']) ); } // Take user back to post after soft delete if (!$hard_delete AND fetch_socialgroup_modperm('canviewdeleted', $group)) { $vbulletin->url .= "&gmid=" . intval($messageinfo[gmid]); } else { if ($is_discussion) { // discussion will be gone, take back to group $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid=" . $vbulletin->GPC['groupid']; } else { // try to take user back to the correct results page $vbulletin->url .= "&page=$pagenumber"; } } if ($is_discussion AND ($hard_delete OR !fetch_socialgroup_modperm('canviewdeleted', $group))) { eval(print_standard_redirect('redirect_groupdiscussiondelete')); } else { eval(print_standard_redirect('redirect_groupmessagedelete')); } } // ############################### start retrieve ip ############################### if ($_REQUEST['do'] == 'viewip') { // check moderator permissions for getting ip if (!can_moderate(0, 'canviewips')) { print_no_permission(); } if (!$messageinfo['gmid']) { eval(standard_error(fetch_error('invalidid', $vbphrase['message'], $vbulletin->options['contactuslink']))); } $messageinfo['hostaddress'] = @gethostbyaddr(long2ip($messageinfo['ipaddress'])); ($hook = vBulletinHook::fetch_hook('group_message_getip')) ? eval($hook) : false; eval(standard_error(fetch_error('thread_displayip', long2ip($messageinfo['ipaddress']), htmlspecialchars_uni($messageinfo['hostaddress'])), '', 0)); } // ############################### start report ############################### if ($_REQUEST['do'] == 'report' OR $_POST['do'] == 'sendemail') { require_once(DIR . '/includes/class_reportitem.php'); if (!$vbulletin->userinfo['userid']) { print_no_permission(); } $reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid)); $reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']); if (!$reportthread AND !$reportemail) { eval(standard_error(fetch_error('emaildisabled'))); } $reportobj = new vB_ReportItem_GroupMessage($vbulletin); $reportobj->set_extrainfo('group', $group); $reportobj->set_extrainfo('discussion', $discussion); $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck) { $reportobj->perform_floodcheck_precommit(); } if (!$messageinfo['gmid']) { eval(standard_error(fetch_error('invalidid', $vbphrase['message'], $vbulletin->options['contactuslink']))); } ($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false; if ($_REQUEST['do'] == 'report') { // draw nav bar $navbits = array(); $navbits['group.php?' . $vbulletin->session->vars['sessionurl']] = $vbphrase['social_groups']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid']] = $group['categoryname']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid=$group[groupid]"] = $group['name']; $navbits['group.php?' . $vbulletin->session->vars['sessionurl'] . "do=discuss&discussionid=$discussion[discussionid]"] = $discussion['title']; $navbits[''] = $vbphrase['report_group_message']; $navbits = construct_navbits($navbits); require_once(DIR . '/includes/functions_editor.php'); $textareacols = fetch_textarea_width(); eval('$usernamecode = "' . fetch_template('newpost_usernamecode') . '";'); eval('$navbar = "' . fetch_template('navbar') . '";'); $url = $vbulletin->url; ($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false; $forminfo = $reportobj->set_forminfo($messageinfo); eval('print_output("' . fetch_template('reportitem') . '");'); } if ($_POST['do'] == 'sendemail') { $vbulletin->input->clean_array_gpc('p', array( 'reason' => TYPE_STR, )); if ($vbulletin->GPC['reason'] == ''hanks')); } } // ####################################################################### if ($_REQUEST['do'] == 'reportpicture' OR $_POST['do'] == 'sendpictureemail') { $vbulletin->input->clean_array_gpc('r', array( 'pictureid' => TYPE_UINT )); require_once(DIR . '/includes/class_reportitem.php'); if (!$vbulletin->userinfo['userid']) { print_no_permission(); } $reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid)); $reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']); if (!$reportthread AND !$reportemail) { eval(standard_error(fetch_error('emaildisabled'))); } if (!$vbulletin->userinfo['userid']) { print_no_permission(); } if (!($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']) OR !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'])) { print_no_permission(); } if ($group['membertype'] != 'member' AND !can_moderate(0, 'caneditalbumpicture')) { print_no_permission(); } $pictureinfo = fetch_socialgroup_picture($vbulletin->GPC['pictureid'], $group['groupid']); if (!$pictureinfo) { standard_error(fetch_error('invalidid', $vbphrase['picture'], $vbulletin->options['contactuslink'])); } $userinfo = fetch_userinfo($pictureinfo['userid']); $reportobj = new vB_ReportItem_GroupPicture($vbulletin); $reportobj->set_extrainfo('user', $userinfo ? $userinfo : array()); $reportobj->set_extrainfo('group', $group); $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck) { $reportobj->perform_floodcheck_precommit(); } ($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false; if ($_REQUEST['do'] == 'reportpicture') { // draw nav bar $navbits = construct_navbits(array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['report_picture'] )); require_once(DIR . '/includes/functions_editor.php'); $textareacols = fetch_textarea_width(); eval('$usernamecode = "' . fetch_template('newpost_usernamecode') . '";'); eval('$navbar = "' . fetch_template('navbar') . '";'); $url = $vbulletin->url; ($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false; $forminfo = $reportobj->set_forminfo($pictureinfo); eval('print_output("' . fetch_template('reportitem') . '");'); } if ($_POST['do'] == 'sendpictureemail') { $vbulletin->input->clean_array_gpc('p', array( 'reason' => TYPE_STR, )); if ($vbulletin->GPC['reason'] == '') { eval(standard_error(fetch_error('noreason'))); } $reportobj->do_report($vbulletin->GPC['reason'], $pictureinfo); $url = $vbulletin->url; eval(print_standard_redirect('redirect_reportthanks')); } } // ####################################################################### if ($_POST['do'] == 'insertpictures' OR $_REQUEST['do'] == 'addpictures') { if ($group['membertype'] != 'member') { standard_error(fetch_error('must_be_group_member')); } if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) { print_no_permission(); } if (!($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']) OR !($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']) OR !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['socnet_groups_albums_enabled'])) { print_no_permission(); } } // ####################################################################### if ($_POST['do'] == 'insertpictures') { $vbulletin->input->clean_array_gpc('p', array( 'pictureurls' => TYPE_STR )); $pictureids = array(); $invalidurls = array(); foreach (preg_split('#\s+#', $vbulletin->GPC['pictureurls']) AS $pictureurl) { if (!trim($pictureurl)) { continue; } if (preg_match('#pictureid=([0-9]+)#', $pictureurl, $match) AND $match[1]) { $pictureids["$match[1]"] = $pictureurl; } else { $invalidurls[] = htmlspecialchars_uni($pictureurl); } } $pictureexists = array(); $addpictures = array(); if ($pictureids) { $addpicture_sql = array(); $pictures_sql = $db->query_read(" SELECT picture.pictureid, picture.userid, picture.caption, picture.extension, picture.filesize, picture.idhash, picture.thumbnail_filesize, picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height, IF(socialgrouppicture.pictureid IS NULL, 0, 1) AS pictureexists, user.username FROM " . TABLE_PREFIX . "picture AS picture LEFT JOIN " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture ON (picture.pictureid = socialgrouppicture.pictureid AND socialgrouppicture.groupid = $group[groupid]) LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = picture.userid) WHERE picture.pictureid IN (" . implode(',', array_keys($pictureids)) . ") AND picture.state = 'visible' "); while ($picture = $db->fetch_array($pictures_sql)) { $picture['dateline'] = TIMENOW; if ($picture['userid'] != $vbulletin->userinfo['userid']) { $invalidurls[] = htmlspecialchars_uni($pictureids["$picture[pictureid]"]); } else if ($picture['pictureexists']) { $pictureexists[] = $picture; } else { $addpicture_sql[] = "($group[groupid], $picture[pictureid], " . TIMENOW . ")"; $addpictures[] = $picture; } ($hook = vBulletinHook::fetch_hook('group_picture_insert')) ? eval($hook) : false; unset($pictureids["$picture[pictureid]"]); } $vbulletin->db->free_result($pictures_sql); if ($addpicture_sql) { $db->query_write(" INSERT IGNORE " . TABLE_PREFIX . "socialgrouppicture (groupid, pictureid, dateline) VALUES " . implode(',', $addpicture_sql) ); } } foreach ($pictureids AS $pictureid => $url) { $invalidurls[] = htmlspecialchars_uni($url); } if ($addpictures) { // rebuild the counter $groupdm =& datamanager_init('SocialGroup', $vbulletin, ERRTYPE_STANDARD); $groupdm->set_existing($group); $groupdm->rebuild_picturecount(); $groupdm->save(); unset($groupdm); } ($hook = vBulletinHook::fetch_hook('group_picture_insert_rebuild')) ? eval($hook) : false; if ($addpictures AND !$pictureexists AND !$invalidurls) { // all successful, we can just take them to the picture list $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid']; eval(print_standard_redirect('pictures_added')); } // show information to user about what happened $messagebits = ''; if ($addpictures) { $picturebits = ''; foreach ($addpictures AS $picture) { $picture = prepare_pictureinfo_thumb($picture, $group); eval('$picturebits .= "' . fetch_template('socialgroups_picturebit') . '";'); } $message_text = $vbphrase['the_following_pictures_added_group_successfully']; eval('$messagebits .= "' . fetch_template('socialgroups_addpicture_messagebit') . '";'); } if ($pictureexists) { $picturebits = ''; foreach ($pictureexists AS $picture) { $picture = prepare_pictureinfo_thumb($picture, $group); eval('$picturebits .= "' . fetch_template('socialgroups_picturebit') . '";'); } $message_text = $vbphrase['the_following_pictures_already_part_group']; eval('$messagebits .= "' . fetch_template('socialgroups_addpicture_messagebit') . '";'); } if ($invalidurls) { $urlbits = ''; foreach ($invalidurls AS $url) { $urlbits .= "
  • $url
  • "; } eval('$messagebits .= "' . fetch_template('socialgroups_addpicture_invalidurl') . '";'); } if ($messagebits) { eval('$messages = "' . fetch_template('socialgroups_addpicture_messages') . '";'); } else { $messages = ''; } define('FROM_INSERT', true); $_REQUEST['do'] = 'addpictures'; ($hook = vBulletinHook::fetch_hook('group_picture_insert_errors')) ? eval($hook) : false; } // ####################################################################### if ($_REQUEST['do'] == 'addpictures') { if (!defined('FROM_INSERT')) { $messages = ''; } $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['add_pictures_to_group'] ); $templatename = 'socialgroups_addpictures'; } // ####################################################################### if ($_POST['do'] == 'doremovepicture' OR $_REQUEST['do'] == 'removepicture') { $vbulletin->input->clean_array_gpc('r', array( 'pictureid' => TYPE_UINT )); if (!($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']) OR !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['socnet_groups_albums_enabled'])) { print_no_permission(); } $pictureinfo = fetch_socialgroup_picture($vbulletin->GPC['pictureid'], $group['groupid']); if (!$pictureinfo) { standard_error(fetch_error('invalidid', $vbphrase['picture'], $vbulletin->options['contactuslink'])); } if ($pictureinfo['userid'] != $vbulletin->userinfo['userid'] AND !fetch_socialgroup_modperm('canremovepicture', $group)) { print_no_permission(); } } // ####################################################################### if ($_POST['do'] == 'doremovepicture') { $vbulletin->input->clean_array_gpc('p', array( 'deny' => TYPE_NOHTML )); // You either clicked no or you're a guest if (!empty($vbulletin->GPC['deny'])) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid']; eval(print_standard_redirect('action_cancelled')); } $db->query_write(" DELETE FROM " . TABLE_PREFIX . "socialgrouppicture WHERE groupid = $group[groupid] AND pictureid = $pictureinfo[pictureid] "); $groupdm =& datamanager_init('SocialGroup', $vbulletin); $groupdm->set_existing($group); $groupdm->rebuild_picturecount(); $groupdm->save(); if (!$group['is_owner'] AND $pictureinfo['userid'] != $vbulletin->userinfo['userid'] AND can_moderate(0, 'caneditalbumpicture')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($pictureinfo, 'social_group_picture_x_in_y_removed', array(fetch_trimmed_title($pictureinfo['caption'], 50), $group['name']) ); } ($hook = vBulletinHook::fetch_hook('group_picture_delete')) ? eval($hook) : false; if ($groupdm->fetch_field('picturecount')) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid']; } else { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; } unset($groupdm); eval(print_standard_redirect('picture_removed_from_group')); } // ####################################################################### if ($_REQUEST['do'] == 'removepicture') { $vbulletin->input->clean_array_gpc('r', array( 'pictureid' => TYPE_UINT )); $confirmdo = 'doremovepicture'; $confirmaction = 'group.php?do=' . $confirmdo; $title_phrase = $vbphrase['remove_picture_from_group']; $question_phrase = construct_phrase($vbphrase['confirm_remove_picture_group_x'], $group['name']); $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['remove_picture_from_group'] ); $templatename = 'socialgroups_confirm'; } // ####################################################################### if ($_REQUEST['do'] == 'grouppictures') { $vbulletin->input->clean_array_gpc('r', array( 'pagenumber' => TYPE_UINT )); if (!($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']) OR !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['socnet_groups_albums_enabled'])) { print_no_permission(); } if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) { print_no_permission(); } if ($group['membertype'] != 'member' AND !can_moderate(0, 'caneditalbumpicture')) { if ($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups'] AND can_join_group($group)) { standard_error(fetch_error('must_be_group_member_view_add_pictures_join_x', 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=join&groupid=' . $group['groupid'])); } else { standard_error(fetch_error('must_be_group_member_view_add_pictures')); } } if ($vbulletin->GPC['pagenumber'] < 1) { $vbulletin->GPC['pagenumber'] = 1; } $perpage = $vbulletin->options['album_pictures_perpage']; $total_pages = max(ceil($group['rawpicturecount'] / $perpage), 1); // 0 pictures still needs an empty page $pagenumber = ($vbulletin->GPC['pagenumber'] > $total_pages ? $total_pages : $vbulletin->GPC['pagenumber']); $start = ($pagenumber - 1) * $perpage; $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('group_pictures_query')) ? eval($hook) : false; $pictures_sql = $db->query_read_slave(" SELECT picture.pictureid, picture.userid, picture.caption, picture.extension, picture.filesize, picture.idhash, picture.thumbnail_filesize, picture.thumbnail_dateline_sql = $db->query_read_slave(" SELECT picture.pictureid, picture.userid, picture.caption, picture.extension, picture.filesize, picture.idhash, picture.thumbnail_filesize, picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height, socialgrouppicture.dateline, user.username $hook_query_fields FROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture INNER JOIN " . TABLE_PREFIX . "picture AS picture ON (picture.pictureid = socialgrouppicture.pictureid) INNER JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = picture.userid AND socialgroupmember.groupid = $group[groupid] AND socialgroupmember.type = 'member') LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = picture.userid) $hook_query_joins WHERE socialgrouppicture.groupid = $group[groupid] $hook_query_where ORDER BY socialgrouppicture.dateline DESC LIMIT $start, $perpage "); // work out the effective picturebit height/width including any borders and paddings; the +4 works around an IE float issue $picturebit_height = $vbulletin->options['album_thumbsize'] + ($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding'] * 2 + 4; $picturebit_width = $vbulletin->options['album_thumbsize'] + ($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding'] * 2; $picturebits = ''; while ($picture = $db->fetch_array($pictures_sql)) { $picture = prepare_pictureinfo_thumb($picture, $group); ($hook = vBulletinHook::fetch_hook('group_picturebit')) ? eval($hook) : false; eval('$picturebits .= "' . fetch_template('socialgroups_picturebit') . '";'); } $db->free_result($pictures_sql); $pagenav = construct_page_nav($pagenumber, $perpage, $group['rawpicturecount'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . "do=grouppictures&groupid=$group[groupid]", '' ); $show['add_pictures_link'] = ($group['membertype'] == 'member' AND $permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']); $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['pictures'] ); $templatename = 'socialgroups_pictures'; } // ####################################################################### if ($_REQUEST['do'] == 'picture') { $vbulletietin->userinfo['userid']) { print_no_permission(); } if (!($permissions['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum']) OR !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['socnet_groups_albums_enabled'])) { print_no_permission(); } if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) { print_no_permission(); } if ($group['membertype'] != 'member' AND !can_moderate(0, 'caneditalbumpicture')) { if ($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups'] AND can_join_group($group)) { standard_error(fetch_error('must_be_group_member_view_add_pictures_join_x', 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=join&groupid=' . $group['groupid'])); } else { standard_error(fetch_error('must_be_group_member_view_add_pictures')); } } $pictureinfo = fetch_socialgroup_picture($vbulletin->GPC['pictureid'], $group['groupid']); if (!$pictureinfo) { standard_error(fetch_error('invalidid', $vbphrase['picture'], $vbulletin->options['contactuslink'])); } $pictureinfo['adddate'] = vbdate($vbulletin->options['dateformat'], $pictureinfo['dateline'], true); $pictureinfo['addtime'] = vbdate($vbulletin->options['timeformat'], $pictureinfo['dateline']); $pictureinfo['caption_html'] = nl2br(fetch_word_wrapped_string(fetch_censored_text($pictureinfo['caption']))); $navpictures_sql = $db->query_read_slave(" SELECT socialgrouppicture.pictureid FROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture INNER JOIN " . TABLE_PREFIX . "picture AS picture ON (socialgrouppicture.pictureid = picture.pictureid) INNER JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = picture.userid AND socialgroupmember.groupid = $group[groupid] AND socialgroupmember.type = 'member') WHERE socialgrouppicture.groupid = $group[groupid] ORDER BY socialgrouppicture.dateline DESC "); $pic_location = fetch_picture_location_info($navpictures_sql, $pictureinfo['pictureid']); $db->free_result($navpictures_sql); ($hook = vBulletinHook::fetch_hook('group_picture')) ? eval($hook) : false; $show['edit_picture_option'] = ($pictureinfo['userid'] == $vbulletin->userinfo['userid'] OR can_moderate(0, 'caneditalbumpicture')); $show['remove_picture_option'] = ($pictureinfo['userid'] == $vbulletin->userinfo['userid'] OR fetch_socialgroup_modperm('canremovepicture', $group)); if ($show['edit_picture_option']) { // we need an album this picture is in to edit it $album = $db->query_first_slave(" SELECT albumid FROM " . TABLE_PREFIX . "albumpicture WHERE pictureid = $pictureinfo[pictureid] LIMIT 1 "); } $show['reportlink'] = ( $vbulletin->userinfo['userid'] AND ($vbulletin->options['rpforumid'] OR ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail'])) ); if ($vbulletin->options['pc_enabled']) { require_once(DIR . '/includes/functions_picturecomment.php'); $pagenumber = $vbulletin->GPC['pagenumber']; $perpage = $vbulletin->GPC['perpage']; $picturecommentbits = fetch_picturecommentbits($pictureinfo, $messagestats, $pagenumber, $perpage, $vbulletin->GPC['commentid'], $vbulletin->GPC['showignored']); $pagenavbits = array( 'do=picture', "groupid=$group[groupid]", "pictureid=$pictureinfo[pictureid]" ); if ($perpage != $vbulletin->options['pc_perpage']) { $pagenavbits[] = "pp=$perpage"; } if ($vbulletin->GPC['showignored']) { $pagenavbits[] = 'showignored=1'; } $pagenav = construct_page_nav($pagenumber, $perpage, $messagestats['total'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . implode('&', $pagenavbits), '' ); $editorid = fetch_picturecomment_editor($pictureinfo, $pagenumber, $messagestats); if ($editorid) { eval('$picturecomment_form = "' . fetch_template('picturecomment_form') . '";'); } else { $picturecomment_form = ''; } $show['picturecomment_options'] = ($picturecomment_form OR $picturecommentbits); eval('$picturecomment_commentarea = "' . fetch_template('picturecomment_commentarea') . '";'); eval('$picturecomment_css = "' . fetch_template('picturecomment_css') . '";'); } else { $picturecomment_commentarea = ''; $picturecomment_css = ''; } $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid'] => $vbphrase['pictures'], '' => $vbphrase['view_picture'] ); $templatename = 'socialgroups_picture'; } // ####################################################################### if ($_POST['do'] == 'sendinvite') { if (!fetch_socialgroup_modperm('caninvitemoderatemembers', $group)) { print_no_permission(); } $vbulletin->input->clean_array_gpc('p', array( 'username' => TYPE_NOHTML )); if ($user = $vbulletin->db->query_first(" SELECT * FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string($vbulletin->GPC['username']) . "'" )) { cache_permissions($user); if ($currentmembership = $vbulletin->db->query_first(" SELECT * FROM " . TABLE_PREFIX . "socialgroupmember WHERE userid = " . $user['userid'] . " AND groupid = " . $group['groupid'] )) { if ($currentmembership['type'] == 'member') { $errormsg = $vbphrase['this_person_is_already_a_member_of_the_group']; $invite_username = $vbulletin->GPC['username']; $_REQUEST['do'] = 'manage'; } else if (!($user['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups']) OR !($user['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'])) { $errormsg = $vbphrase['this_user_is_not_allowed_to_join_groups']; $invite_username = $vbulletin->GPC['username']; $_REQUEST['do'] = 'manage'; } else { $socialgroupmemberdm =& datamanager_init('SocialGroupMember', $vbulletin); $socialgroupmemberdm->set_existing($currentmembership); $socialgroupmemberdm->set('type', 'invited'); $socialgroupmemberdm->set('dateline', TIMENOW); $socialgroupmemberdm->save(); unset($socialgroupmemberdm); if (!$group['is_owner'] AND can_moderate(0, 'candeletesocialgroups')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($group, 'social_group_x_members_managed', array($group['name']) ); } $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=manage&groupid=' . $group['groupid']; eval(print_standard_redirect('successfully_invited_user')); } } else { if (!($user['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups']) OR !($user['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'])) { $errormsg = $vbphrase['this_user_is_not_allowed_to_join_groups']; $invite_username = $vbulletin->GPC['username']; $_REQUEST['do'] = 'manage'; } else { $socialgroupmemberdm =& datamanager_init('SocialGroupMember', $vbulletin); $socialgroupmemberdm->set('userid', $user['userid']); $socialgroupmemberdm->set('groupid', $group['groupid']); $socialgroupmemberdm->set('type', 'invited'); $socialgroupmemberdm->set('dateline', TIMENOW); $socialgroupmemberdm->save(); unset($socialgroupmemberdm); if (!$group['is_owner'] AND can_moderate(0, 'candeletesocialgroups')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($group, 'social_group_x_members_managed', array($group['name']) ); } $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=manage&groupid=' . $group['groupid']; eval(print_standard_redirect('successfully_invited_user')); } } } else { $errormsg = $vbphrase['user_does_not_exist']; $invite_username = $vbulletin->GPC['username']; $_REQUEST['do'] = 'manage'; } } // ############# Permission checks for group management ################## if ($_REQUEST['do'] == 'manage' OR $_POST['do'] == 'cancelinvites') { if (!fetch_socialgroup_modperm('caninvitemoderatemembers', $group)) { print_no_permission(); } } if ($_REQUEST['do'] == 'managemembers' OR $_POST['do'] == 'kickmembers') { if (!fetch_socialgroup_modperm('canmanagemembers', $group)) { print_no_permission(); } } // ####################################################################### if ($_REQUEST['do'] == 'manage' OR $_REQUEST['do'] == 'managemembers') { $members = $vbulletin->db->query_read(" SELECT socialgroupmember.*, user.username FROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroupmember.userid) WHERE groupid = $group[groupid] " . ($_REQUEST['do'] == 'managemembers' ? "AND type = 'member'" : "AND type <> 'member'") . " O(user.userid = socialgroupmember.userid) WHERE groupid = $group[groupid] " . ($_REQUEST['do'] == 'managemembers' ? "AND type = 'member'" : "AND type <> 'member'") . " ORDER BY user.username "); $invitebits = ''; $moderatebits = ''; $memberbits = ''; $i = 0; while ($user = $vbulletin->db->fetch_array($members)) { ($hook = vBulletinHook::fetch_hook('group_manage_memberbit')) ? eval($hook) : false; if ($user['type'] == 'invited') { $container = 'invitedlist'; eval('$invitebits .= "' . fetch_template('socialgroups_managebit') . '";'); } else if ($user['type'] == 'moderated') { $container = 'moderatedlist'; eval('$moderatebits .= "' . fetch_template('socialgroups_managebit') . '";'); } else if ($user['userid'] != $group['creatoruserid']) { eval('$memberbits .= "' .fetch_template('socialgroups_managebit') . '";'); } } $vbulletin->db->free_result($members); eval('$socialgroups_css = "' . fetch_template('socialgroups_css') . '";'); $show['manage_members'] = ($_REQUEST['do'] == 'managemembers'); $navbits = array( 'group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'cat=' . $group['socialgroupcategoryid'] => $group['categoryname'], 'group.php?'. $vbulletin->session->vars['sessionurl'] .'groupid=' . $group['groupid'] => $group['name'], '' => $show['manage_members'] ? $vbphrase['manage_members'] : $vbphrase['pending_and_invited_members'] ); $custompagetitle = $group['name'] . ' - ' . ($show['manage_members'] ? $vbphrase['manage_members'] : $vbphrase['pending_and_invited_members']); $templatename = ($_REQUEST['do'] == 'managemembers' ? 'socialgroups_managemembers' : 'socialgroups_manage'); } // ####################################################################### if ($_POST['do'] == 'cancelinvites' OR $_POST['do'] == 'kickmembers') { $vbulletin->input->clean_array_gpc('p', array( 'ids' => TYPE_ARRAY_KEYS_INT )); if (sizeof($vbulletin->GPC['ids']) > 0) { $socialgroupmemberdm =& datamanager_init('SocialGroupMember', $vbulletin); $vbulletin->GPC['ids'][] = 0; $ids = implode(', ', $vbulletin->GPC['ids']); $invites = $vbulletin->db->query_read(" SELECT * FROM " . TABLE_PREFIX . "socialgroupmember WHERE groupid = " . $group['groupid'] . " AND userid IN($ids)" . ($_POST['do'] == 'cancelinvites' ? " AND type = 'invited'" : '') ); while ($invite = $vbulletin->db->fetch_array($invites)) { ($hook = vBulletinHook::fetch_hook('group_kickmember')) ? eval($hook) : false; if ($invite['userid'] != $group['creatoruserid']) { $socialgroupmemberdm->set_existing($invite); $socialgroupmemberdm->delete(); } } $vbulletin->db->free_result($invites); unset ($socialgroupmemberdm); } if (!$group['is_owner'] AND can_moderate(0, 'candeletesocialgroups')) { require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($group, 'social_group_x_members_managed', array($group['name']) ); } if (($group['members'] - sizeof($ids) <= 1) AND $_REQUEST['do'] == 'kickmembers') { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; } else { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=manage' . ($_REQUEST['do'] == 'kickmembers' ? 'members' : '') . '&groupid=' . $group['groupid']; } ($hook = vBulletinHook::fetch_hook('group_kickmember_complete')) ? eval($hook) : false; $phrase = $_POST['do'] == 'cancelinvites' ? 'successfully_removed_invites' : 'successfully_kicked_members'; eval(print_standard_redirect($phrase)); } // ####################################################################### if ($_POST['do'] == 'pendingmembers') { if (!fetch_socialgroup_modperm('caninvitemoderatemembers', $group)) { print_no_permission(); } $vbulletin->input->clean_array_gpc('p', array( 'ids' => TYPE_ARRAY_KEYS_INT, 'action' => TYPE_STR )); $vbulletin->GPC['ids'][] = 0; $ids = implode(', ', $vbulletin->GPC['ids']); $members = $vbulletin->db->query_read(" SELECT * FROM " . TABLE_PREFIX . "socialgroupmember WHERE groupid = " . $group['groupid'] . " AND type = 'moderated' AND userid IN ($ids) "); while ($member = $vbulletin->db->fetch_array($members)) { $socialgroupmemberdm =& datamanager_init('SocialGroupMember', $vbulletin); $socialgroupmemberdm->set_existing($member); ($hook = vBulletinHook::fetch_hook('group_pending_members')) ? eval($hook) : false; if ($vbulletin->GPC['action'] == 'deny') { $socialgroupmemberdm->delete(); } else if ($vbulletin->GPC['action'] == 'accept') { $socialgroupmemberdm->set('type', 'member'); $socialgroupmemberdm->save(); } unset($socialgroupmemberdm); } $vbulletin->db->free_result($members); $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=manage&groupid=' . $group['groupid']; ($hook = vBulletinHook::fetch_hook('group_pending_members_complete')) ? eval($hook) : false; eval(print_standard_redirect('successfully_managed_members')); } // ####################################################################### if ($_REQUEST['do'] == 'quickedit') { $vbulletin->input->clean_array_gpc('p', array( 'editorid' => TYPE_NOHTML, )); require_once(DIR . '/includes/class_xml.php'); require_once(DIR . '/includes/functions_editor.php'); $editorid = construct_edit_toolbar( htmlspecialchars_uni($messageinfo['pagetext']), false, 'groupmessage', true, true, false, 'qenr', $vbulletin->GPC['editorid'] ); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('quickedit'); $xml->add_tag('editor', process_replacement_vars($messagearea), array( 'reason' => '', 'parsetype' => 'groupmessage', 'parsesmilies' => true, 'mode' => $show['is_wysiwyg_editor'] )); $xml->close_group(); $xml->print_xml(); } // ####################################################################### if ($_POST['do'] == 'updateicon') { if (!$vbulletin->options['sg_enablesocialgroupicons']) { eval(standard_error(fetch_error('socialgroupiconsdisabled'))); } if (!fetch_socialgroup_perm('canuploadgroupicon')) { print_no_permission(); } $vbulletin->input->clean_array_gpc('p', array( 'deletegroupicon' => TYPE_BOOL, 'iconurl' => TYPE_STR, 'icononly' => TYPE_BOOL, 'skip' => TYPE_STR )); if (!$vbulletin->GPC['skip']) { ($hook = vBulletinHook::fetch_hook('group_update_groupicon_start')) ? eval($hook) : false; if ($vbulletin->GPC['deletegroupicon']) { $groupicon =& datamanager_init('SocialGroupIcon', $vbulletin, ERRTYPE_STANDARD); $groupicon->condition = "groupid = " . $group['groupid']; $groupicon->delete(); unset($groupicon); } else { $vbulletin->input->clean_gpc('f', 'upload', TYPE_FILE); require_once(DIR . '/includes/class_upload.php'); require_once(DIR . '/includes/class_image.php'); $upload = new vB_Upload_SocialGroupIcon($vbulletin); $upload->data =& datamanager_init('SocialGroupIcon', $vbulletin, ERRTYPE_STANDARD); $upload->image =& vB_Image::fetch_library($vbulletin); $upload->set_group_info($group); $upload->maxwidth = FIXED_SIZE_GROUP_ICON_WIDTH; $upload->maxheight = FIXED_SIZE_GROUP_ICON_HEIGHT; $upload->maxuploadsize = $vbulletin->userinfo['permissions']['groupiconmaxsize']; $upload->allowanimation = fetch_socialgroup_perm('cananimategroupicon'); if (!$upload->process_upload($vbulletin->GPC['iconurl'])) { eval(standard_error($upload->fetch_error())); } unset($upload); } ($hook = vBulletinHook::fetch_hook('group_update_groupicon_complete')) ? eval($hook) : false; } if ($vbulletin->GPC['icononly']) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; eval(print_standard_redirect('successfully_created_group')); } eval(print_standard_redirect('redirect_updatethanks')); } // ####################################################################### if ($templatename != '') { ($hook = vBulletinHook::fetch_hook('group_complete')) ? eval($hook) : false; // make navbar $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); $custompagetitle = empty($custompagetitle) ? $pagetitle : $custompagetitle; eval('print_output("' . fetch_template($templatename) . '");'); } ?> fetch_socialgroup_perm('cananimategroupicon'); if (!$upload->process_upload($vbulletin->GPC['iconurl'])) { eval(standard_error($upload->fetch_error())); } unset($upload); } ($hook = vBulletinHook::fetch_hook('group_update_groupicon_complete')) ? eval($hook) : false; } if ($vbulletin->GPC['icononly']) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; eval(print_standard_redirect('successfully_created_group')); } eval(print_standard_redirect('redirect_updatethanks')); } // ####################################################################### if ($templatename != '') { ($hook = vBulletinHook::fetch_hook('group_complete')) ? eval($hook) : false; // make navbar $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); $custompagetitle = empty($custompagetitle) ? $pagetitle : $custompagetitle; eval('print_output("' . fetch_template($templatename) . '");'); } ?> al('$navbar = "' . fetch_template('navbar') . '";'); $custompagetitle = empty($custompagetitle) ? $pagetitle : $custompagetitle; eval('print_output("' . fetch_template($templatename) . '");'); } ?>