sub Ad_Info ( \ Date_Expires as Date, \ Cost_Per_Day as integer, \ User_ID as long, \ User_Name as string, \ byval Menu_Dat as string ) ////////////////////////////////////////////////////////////////////// dim File_Menu_Dat as integer dim Line as string ////////////////////////////////////////////////////////////////////// // Initializing outputs to defaults... CurrentDate ( Date_Expires ) Cost_Per_Day = 0 User_ID = -1 User_Name = "" if not Exists ( Menu_Dat ) then exit sub end if // ...done. File_Menu_Dat = FreeFile open Menu_Dat for input as File_Menu_Dat input #File_Menu_Dat, Line DateStringToDate ( DATE_MASK_ISO, Line, Date_Expires ) input #File_Menu_Dat, Cost_Per_Day input #File_Menu_Dat, User_ID input #File_Menu_Dat, User_Name close ( File_Menu_Dat ) end sub function Ad_Made ( byval Lines as integer ) as boolean ////////////////////////////////////////////////////////////////////// Ad_Made = false do if not EditFile ( BBS_Ad_Tmp, Lines, \ "Press Escape then S to save or A to abort" ) then del BBS_Ad_Tmp exit do end if Filter_Ad ( BBS_Ad_Tmp ) ClS DisplayMenu ( BBSAdTmp_BBS ) ? ? if InputYesNo ( "Is this how you want your ad to appear? (Y/n): ", true ) then Ad_Made = true exit do else ? ? "You may re-edit your ad now." ? "To abort your ad, press Escape then A from within the editor." ? WaitEnter end if loop end function sub Filter_Ad ( byval Ad_Tmp as string ) ////////////////////////////////////////////////////////////////////// dim Line as string dim File_Num_Bad as integer ////////////////////////////////////////////////////////////////////// ? "Filtering..."; if Exists ( BBS_Ad_Bad ) then File_Num_Bad = FreeFile open BBS_Ad_Bad for input as File_Num_Bad while not EOF ( File_Num_Bad ) input #File_Num_Bad, Line ? "."; if not File_Text_Filter ( Ad_Tmp, Line ) then Beep ? "Error filtering "; Ad_Tmp; "!" WaitEnter end end if wend close ( File_Num_Bad ) else if not File_Text_Filter ( Ad_Tmp, "@LOGOFF@" ) then Beep ? "Error filtering "; Ad_Tmp; "!" WaitEnter end end if end if ? end sub sub Menu_Info ( \ Cost as integer, \ Date_Expires as Date , \ Cost_Per_Day as integer, \ Refund_Cost as integer, \ Refund_User_ID as long , \ Refund_User_Name as string , \ Refund_Days as integer, \ byval Lines as integer, \ byval Menu_Dat as string , \ byval Cost_Per_Day_Min as integer, \ byval Cost_Per_Day_Max as integer, \ byval Days_Max as integer ) ////////////////////////////////////////////////////////////////////// dim Cost_Min as integer dim Days as integer dim Days_Left as integer dim Default_Cost_Per_Day as integer dim Default_Days as integer dim Refund as integer dim User_ID as long dim User_Name as string dim User_Rec as UserRecord ////////////////////////////////////////////////////////////////////// ? "You can create your own BBS advertisement to be displayed in "; ? "the menu." ? "If you know Wildcat! BBS @ color codes, you can use those as well!" ? ? "Your ad will last until someone overwrites it with another ad." ? "If that happens, you will receive a partial refund for any unused" ? "days up to the amount of days purchased. You may purchase up to" Color ( 12 ) ? Days_Max; Color ( 15 ) ? " days. Note that your ad may last longer than the number" ? "of days you purchase if no one creates a new ad." ? ? "You will be able to write up to "; Lines; " line(s)." Ad_Info ( Date_Expires, Cost_Per_Day, User_ID, User_Name, Menu_Dat ) Days_Left = -Days_Since_Today ( Date_Expires ) Cost_Min = 0 if ( User_ID > -1 ) and ( Days_Left > 0 ) then Color ( 12 ) ? User_Name; " ["; User_ID; "] currently has this ad space until "; ? FormatDate ( Date_Expires, DATE_MASK_ISO ); "." ? "You can have this space if you want to spend at least "; Cost_Min = Maximum ( Cost_Per_Day * Days_Left + 1, Cost_Per_Day_Min ) ? Dollars_Str ( Cost_Min ); "." ? User_Name; " will be refunded for any unused days." ? Color ( 10 ) end if if User.SubscriptionBalance < Cost_Min then ? "To increase your account balance, please contact your SysOp." WaitEnter end end if Default_Cost_Per_Day = Maximum ( Cost_Per_Day_Min, \ fix ( Cost_Min / Days_Max + 0.99 ) ) if Default_Cost_Per_Day > Cost_Per_Day_Max then Default_Cost_Per_Day = Cost_Per_Day_Max end if Cost_Per_Day = Integer_Ask ( \ "How much do you want to pay per day, in cents? ", \ Default_Cost_Per_Day, Cost_Per_Day_Max, Default_Cost_Per_Day ) if Cost_Per_Day > 0 then Default_Days = Maximum ( fix ( Cost_Min / Cost_Per_Day + 0.5 ), 1 ) if Default_Days > Days_Max then Default_Days = Days_Max end if else if Cost_Per_Day < Cost_Min then ? "You must spend at least "; Dollars_Str ( Cost_Min ); "." WaitEnter end end if Default_Days = Days_Max end if Days = Integer_Ask ( \ "How many days do you want your ad to run? (0=Abort) ", 0, \ Days_Max, Default_Days ) if Days <= 0 then end end if Cost = Cost_Per_Day * Days ? Dollars_Str ( Cost_Per_Day ); " per day for "; Days; " days = "; ? Dollars_Str ( Cost ); "." if Cost < Cost_Min then ? "You must spend at least "; Dollars_Str ( Cost_Min ); "." WaitEnter end end if if User.SubscriptionBalance < Cost then ? "To increase your account balance, please contact your SysOp." WaitEnter end end if ? "Your account balance will be charged "; ? Dollars_Str ( Cost ); "." CurrentDate ( Date_Expires ) Date_Expires.Number = Date_Expires.Number + Days ? "The last day of your ad will be "; ? FormatDate ( Date_Expires, DATE_MASK_ISO ); "." ? if not InputYesNo ( "Proceed with ad? (Y/n): ", true ) then end end if if Cost_Min > 1 then Refund_Cost = Cost_Min - 1 Refund_User_ID = User_ID Refund_User_Name = User_Name Refund_Days = Days_Left else Refund_Cost = 0 Refund_User_ID = -1 Refund_User_Name = "" Refund_Days = 0 end if end sub sub Refund_Send ( \ byval Menu_Dat as string, \ byval Refund_Cost as integer, \ byval Refund_User_ID as long, \ byval Refund_User_Name as string, \ byval Refund_Days as integer ) ////////////////////////////////////////////////////////////////////// dim User_Rec as UserRecord ////////////////////////////////////////////////////////////////////// if ( Refund_Cost <= 0 ) or ( Refund_User_ID < 0 ) \ or ( Refund_User_Name = "" ) or ( Refund_Days < 1 ) then exit sub end if ? "Refunding "; Dollars_Str ( Refund_Cost ); " to "; ? Refund_User_Name; " ["; Refund_User_ID; "] for "; ? Refund_Days; " unused days." del Menu_Dat if ( Refund_User_Name = User.Name ) and \ ( Refund_User_ID = User.UserID ) then User.SubscriptionBalance \ = User.SubscriptionBalance + Refund_Cost ? "Done." else if not User_Record_Found ( \ User_Rec, Refund_User_Name, Refund_User_ID ) then ? "User record not found. No refund given." end if User_Rec.SubscriptionBalance \ = User_Rec.SubscriptionBalance + Refund_Cost if UpdateUser ( User_Rec ) then ? "Done." else ? "Error. No refund given." end if end if WaitEnter end sub