'; $sMain = 'position:relative; float:left;'; $sQuery = "SELECT `GlParams`.`Name`, `VALUE` as `Value`, `desc`, `Type`, `GlParamsKateg`.`name` AS `kategName`, `order_in_kateg` as `Order` FROM `GlParams` LEFT JOIN `GlParamsKateg` ON `GlParamsKateg`.`ID` = `GlParams`.`kateg` WHERE ".$sCat." AND `GlParams`.`Name` NOT LIKE '%_subject' OR `GlParams`.`Name` = 'free_mode' ORDER BY `kateg`,`order_in_kateg` ASC"; $sCode = '
'; $rData = db_res($sQuery); while($aData = mysql_fetch_assoc($rData)) { $sField = ''; $sCode .= '
'; $sCode .= '
'.$aData['desc'].'
'; switch($aData['Type']) { case 'checkbox': $sField = '
'; break; case 'digit': $sField = '
'; break; default: } $sCode .= $sField.$sClear.'
'; } $sCode .= '
'; $sCode .= '
'; return $sCode; } function saveMemSettings() { $aDigit = array('expire_notification_days','promotion_membership_days'); $aCheck = array('expire_notify_once','enable_promotion_membership','free_mode'); foreach ($aDigit as $i => $sVal) { if ($_POST[$sVal]) { setparam($sVal, htmlspecialchars_adv($_POST[$sVal])); } } foreach ($aCheck as $i => $sVal) { if ('on' == $_POST[$sVal]) { setparam($sVal, 'on'); } else { setparam($sVal, ''); } } } function addMembership($membershipName) { $membershipName = trim($membershipName); if(!$membershipName) return ''; if(!get_magic_quotes_gpc()) $membershipName = addslashes($membershipName); @mysql_query("INSERT INTO MemLevels (Name) VALUES ('$membershipName')"); if(mysql_affected_rows() > 0) { if(!get_magic_quotes_gpc()) $membershipName = stripslashes($membershipName); return "\n
'".htmlspecialchars($membershipName)."' membership has been added
"; } return "\n
Error: membership has not been added
"; } function deleteMembership($membershipID) { $membershipID = (int)$membershipID; if($membershipID <= 0) return ''; $resMemLevel = mysql_query("SELECT Removable FROM MemLevels WHERE ID = $membershipID"); if(mysql_num_rows($resMemLevel) < 1) { return "\n
Error: no such membership
"; } //check if membership can be removed $removable = mysql_fetch_assoc($resMemLevel); $removable = $removable['Removable'] == 'yes' ? true : false; if(!$removable) { return "\n
Error: this membership cannot be removed
"; } //check if there are still members using this membership $resMaxDateExpires = @mysql_query(" SELECT UNIX_TIMESTAMP(MAX(DateExpires)) as MaxDateExpires FROM ProfileMemLevels WHERE IDLevel = $membershipID"); //mysql_num_rows() for the query above is always 1 $maxDateExpires = mysql_fetch_assoc($resMaxDateExpires); $maxDateExpires = $maxDateExpires['MaxDateExpires']; if($maxDateExpires > time()) { return "\n
There are currently members using this membership so it cannot be deleted.
If you want to delete this membership, please make it inactive and wait until it expires for all members currently using it (".date("F j, Y, g:i a", $maxDateExpires).").
"; } @mysql_query("DELETE FROM MemLevelPrices WHERE IDLevel = $membershipID"); @mysql_query("DELETE FROM MemLevelActions WHERE IDLevel = $membershipID"); @mysql_query("DELETE FROM MemLevels WHERE ID = $membershipID"); if(mysql_affected_rows() > 0) { return "\n
Membership has been deleted
"; } return "\n
Error: membership has not been deleted
"; } function activateMembership($membershipID, $active) { $membershipID = (int)$membershipID; if($active != 'yes' && $active != 'no') return ''; if($membershipID <= 0) return ''; $resMemLevel = mysql_query("SELECT Purchasable FROM MemLevels WHERE ID = $membershipID"); if(mysql_num_rows($resMemLevel) < 1) { return "\n
Error: no such membership
"; } //check if membership can be purchased $purchasable = mysql_fetch_assoc($resMemLevel); $purchasable = $purchasable['Purchasable'] == 'yes' ? true : false; if(!$purchasable) { return "\n
Error: this membership cannot be (de)activated because it's not purchasable.
"; } @mysql_query("UPDATE MemLevels SET Active = '$active' WHERE ID = $membershipID"); if(mysql_affected_rows() <= 0){ $de = $active ? '' : 'de'; return "\n
Error: membership has not been {$de}activated
"; } return ''; } function membershipList() { $editLevel = (int)$_GET['edit_level']; ob_start(); //ContentBlockHead("Manage Membership Types"); ?>
New membership:
>
Membership Types
There are no membership levels available at the moment
Pricing
Delete
Error: payment option has not been added"; @mysql_query("INSERT INTO MemLevelPrices (IDLevel, Days, Price) VALUES ($membershipID, $days, $price)"); if(mysql_affected_rows() > 0) { if ( $days > 0 ) { return "\n
{$days}-day payment option added successfully
"; } else { return "\n
Lifetime membership payment option added successfully
"; } } return "\n
Error: payment option has not been added
"; } function deletePaymentOption($membershipID, $days) { $membershipID = (int)$membershipID; $days = (int)$days; if($membershipID <= 0 || $days < 0) return ''; @mysql_query("DELETE FROM MemLevelPrices WHERE IDLevel = $membershipID AND Days = $days"); if(mysql_affected_rows() > 0) { if ( $days > 0 ) { return "\n
{$days}-day payment option deleted successfully
"; } else { return "\n
Lifetime membership payment option deleted successfully
"; } } return "\n
Error: payment option has not been deleted
"; } function membershipPricing($membershipID) { $membershipID = (int)$membershipID; if($membershipID <= 0) return ''; //check if membership can be purchased $resMemLevel = mysql_query("SELECT Purchasable FROM MemLevels WHERE ID = $membershipID"); if(mysql_num_rows($resMemLevel) < 1) { return "\n
Error: no such membership
"; } $purchasable = mysql_fetch_assoc($resMemLevel); $purchasable = $purchasable['Purchasable'] == 'yes' ? true : false; if(!$purchasable) { return "\n
Error: this membership cannot be purchased
"; } ob_start(); ContentBlockHead("Pricing"); ?>
Number of days (0 = life-time membership): Price:
Days Price
There are no payment options defined for this membership
0 ? $arrPaymentOption['Days'] : 'Life-Time Membership' ?>
Delete
Error: membership action has not been added"; $msgAdded = "\n
Membership action has been added
"; if($membershipID <= 0 || $actionID <= 0) return ''; @mysql_query("INSERT INTO MemLevelActions (IDLevel, IDAction, AllowedCount, AllowedPeriodLen, AllowedPeriodStart, AllowedPeriodEnd) VALUES ($membershipID, $actionID, NULL, NULL, NULL, NULL)"); if(mysql_affected_rows() > 0) return $msgAdded; else return $msgNotAdded; } function deleteMembershipAction($membershipID, $actionID) { $membershipID = (int)$membershipID; $actionID = (int)$actionID; $msgNotDeleted = "\n
Error: membership action has not been deleted
"; $msgDeleted = "\n
Membership action has been deleted
"; if($membershipID <= 0 || $actionID <= 0) return ''; @mysql_query("DELETE FROM MemLevelActions WHERE IDLevel = $membershipID AND IDAction = $actionID"); if(mysql_affected_rows() > 0) return $msgDeleted; else return $msgNotDeleted; } function updateMembershipAction($membershipID, $actionID, $cnt, $periodLen, $periodStart, $periodEnd, $additionalParam='') { $membershipID = (int)$membershipID; $actionID = (int)$actionID; $msgNotUpdated = "\n
Error: action has not been updated
"; $msgUpdated = "\n
Action settings have been updated
"; if($membershipID <= 0 || $actionID <= 0) return ''; $cnt = (int)$cnt; $periodLen = (int)$periodLen; if($cnt <= 0) $cnt = 'NULL'; if($periodLen <= 0) $periodLen = 'NULL'; if($periodStart == '') $periodStart = 'NULL'; else $periodStart = strtotime($periodStart); if($periodEnd == '') $periodEnd = 'NULL'; else $periodEnd = strtotime($periodEnd); if($additionalParam == '') { $additionalParam = 'NULL'; } else { if(!get_magic_quotes_gpc()) $additionalParam = addslashes($additionalParam); $additionalParam = "'".$additionalParam."'"; } if($periodStart == -1 || $periodEnd == -1) return $msgNotUpdated; $periodStart = "FROM_UNIXTIME($periodStart)"; $periodEnd = "FROM_UNIXTIME($periodEnd)"; @mysql_query(" UPDATE MemLevelActions SET AllowedCount = $cnt, AllowedPeriodLen = $periodLen, AllowedPeriodStart = $periodStart, AllowedPeriodEnd = $periodEnd, AdditionalParamValue = $additionalParam WHERE IDLevel = $membershipID AND IDAction = $actionID"); if(mysql_affected_rows() > 0) { return $msgUpdated; }else { if(mysql_errno() == 0) return ''; return $msgNotUpdated; } } function membershipActions($membershipID) { global $IDNonMember; global $site; $membershipID = (int)$membershipID; if($membershipID <= 0) return ''; ob_start(); ContentBlockHead("Membership Actions"); ?>
$desc) { if( !$arrLevelActions[$ID] ) $optionsText .= "\n"; } if ( strlen($optionsText) ) { ?>
$arrAction) { ?>
Show
Number of allowed actions: />
Number of actions is reset every: />  hours
This action is available since:
This action is available until:
No actions allowed for this membership