$value){ if (!is_array($value)) $HTTP_POST_VARS[$key] = $value; if (isset($$key)) unset($$key); } } if (is_array($HTTP_GET_VARS)) { foreach ($HTTP_GET_VARS as $key => $value){ $HTTP_GET_VARS[$key] = $value; if (isset($$key)) unset($$key); } } if (is_array($HTTP_COOKIE_VARS)) { foreach ($HTTP_COOKIE_VARS as $key => $value){ if (isset($$key)) unset($$key); } } // Initialise the $CONFIG array and some other variables $CONFIG=array(); $PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; $REFERER = urlencode( $PHP_SELF . (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING'] ? '?'.$HTTP_SERVER_VARS['QUERY_STRING'] : '')); $ALBUM_SET =''; $FORBIDDEN_SET =''; $CURRENT_CAT_NAME =''; // Define some constants define('USER_GAL_CAT', 1); define('FIRST_USER_CAT', 10000); define('RANDPOS_MAX_PIC', 200); define('RANDPOS_INTERVAL',5); //define('TEMPLATE_FILE', 'template.html'); $IMG_TYPES = array( 1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF' ); // Include config and functions files require XOOPS_ROOT_PATH."/modules/xcgal/include/functions.inc.php"; // Parse cookie stored user profile user_get_profile(); // Authenticate if (is_object($xoopsUser)) { $cookie_uid = $xoopsUser->getVar('uid'); //$cookie_pass = substr(addslashes($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_pass']), 0, 32); } else { $cookie_uid = 0; $cookie_pass = '*'; } if (is_object($xoopsUser)){ $usergroups = $xoopsUser->getGroups(); $usergroup= implode(",",$usergroups); $mygroup= $xoopsUser->getGroups(); $sql = "SELECT * FROM ".$xoopsDB->prefix("xcgal_usergroups")." WHERE xgroupid IN ({$usergroup})"; $results = $xoopsDB->query($sql); $USER_DATA['can_send_ecards'] = 0; $USER_DATA['can_rate_pictures'] = 0; $USER_DATA['can_post_comments'] = 0; $USER_DATA['can_upload_pictures'] = 0; $USER_DATA['can_create_albums'] = 0; $USER_DATA['pub_upl_need_approval'] = 1; $USER_DATA['priv_upl_need_approval'] = 1; $USER_DATA['group_quota'] = 0; $USER_DATA['group_id'] = $usergroups; while($ugroup=$xoopsDB->fetchArray($results)){ if ($ugroup['can_send_ecards'] == 1) $USER_DATA['can_send_ecards'] = $ugroup['can_send_ecards']; if ($ugroup['can_rate_pictures'] == 1) $USER_DATA['can_rate_pictures'] = $ugroup['can_rate_pictures']; if ($ugroup['can_post_comments'] == 1) $USER_DATA['can_post_comments'] = $ugroup['can_post_comments']; if ($ugroup['can_upload_pictures'] == 1) $USER_DATA['can_upload_pictures'] = $ugroup['can_upload_pictures']; if ($ugroup['can_create_albums'] == 1) $USER_DATA['can_create_albums'] = $ugroup['can_create_albums']; if ($ugroup['pub_upl_need_approval'] == 0) $USER_DATA['pub_upl_need_approval'] = $ugroup['pub_upl_need_approval']; if ($ugroup['priv_upl_need_approval'] == 0) $USER_DATA['pub_upl_need_approval'] = $ugroup['priv_upl_need_approval']; if ($ugroup['group_quota'] > $USER_DATA['group_quota']) $USER_DATA['group_quota'] = $ugroup['group_quota']; } // while $xoopsModule = XoopsModule::getByDirname('xcgal'); if($xoopsUser->isAdmin($xoopsModule->mid())) define('USER_IS_ADMIN', 1); else define('USER_IS_ADMIN', 0); //$USER_DATA = $xoopsDB->fetchArray($results); $USER_DATA['user_email']= $xoopsUser->email(); define('USER_ID', $xoopsUser->getVar('uid')); define('USER_NAME', $xoopsUser->uname()); define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']); define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']); define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']); define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']); define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']); $xoopsDB->freeRecordSet($results); } else { $results = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("xcgal_usergroups")." WHERE group_id = ".XOOPS_GROUP_ANONYMOUS.""); if (!($xoopsDB->getRowsNum($results))) die('Coppermine critical error:
The group table does not contain the Anonymous group !'); $USER_DATA = $xoopsDB->fetchArray($results); define('USER_ID', 0); define('USER_NAME', $xoopsConfig['anonymous']); define('USER_IS_ADMIN', 0); define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']); define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']); define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']); define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']); define('USER_CAN_CREATE_ALBUMS', 0); $xoopsDB->freeRecordSet($results); } // Test if admin mode $USER['am'] = isset($USER['am']) ? (int)$USER['am'] : 0; define('GALLERY_ADMIN_MODE', USER_IS_ADMIN && $USER['am']); define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && $USER['am'] && !GALLERY_ADMIN_MODE); ?>