'); my $mtitle = "$count Entries - Page $page of $npages"; $content = "

"; } (!$content)&&($content = ''); my $mtitle = "Forums"; $content = "

\n"; } if($in{'namereq'} eq 'checked'){ my $mess; ($in{'namehid'} eq 'checked')&&($mess = '(hidden from public)'); $fields .= "\n"; } if($in{'emailreq'} eq 'checked'){ my $mess; ($in{'emailhid'} eq 'checked')&&($mess = '(hidden from public)'); $fields .= "\n"; } if($in{'command'} eq 'sa'){ if(($in{'c1a'} eq 'checked')&&($in{'c1'})){ my $mess; ($in{'c1h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c1r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c2a'} == 'checked')&&($in{'c2'})){ my $mess; ($in{'c2h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c2r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c3a'} == 'checked')&&($in{'c3'})){ my $mess; ($in{'c3h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c3r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c4a'} == 'checked')&&($in{'c4'})){ my $mess; ($in{'c4h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c4r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c5a'} == 'checked')&&($in{'c5'})){ my $mess; ($in{'c5h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c5r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c6a'} == 'checked')&&($in{'c6'})){ my $mess; ($in{'c6h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c6r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c7a'} == 'checked')&&($in{'c7'})){ my $mess; ($in{'c7h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c7r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c8a'} == 'checked')&&($in{'c8'})){ my $mess; ($in{'c8h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c8r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c9a'} == 'checked')&&($in{'c9'})){ my $mess; ($in{'c9h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c9r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } if(($in{'c10a'} == 'checked')&&($in{'c10'})){ my $mess; ($in{'c10h'} eq 'checked')&&($mess = '(hidden from public)'); ($in{'c10r'} eq 'checked')?($rn='*'):($rn=''); $fields .= "\n"; } } if(-f "$datapath/$in{'gid'}-ts.htm"){ open(FILE,"<$datapath/$in{'gid'}-ts.htm"); while(){ $buffer .= $_; } close FILE; } else{ open(FILE,"<$cgipath/t_public_add.htm"); while(){ $buffer .= $_; } close FILE; } if($in{'dui'}){ $iconstart=''; } else{ $iconstart=''; $iconend = ''; } if($in{'docatalog'}){ $smiliestart=''; } else{ $smiliestart=''; $smilieend = ''; $in{'am'} = '(click icons below to add within message at cursor)'; } if($in{'html'} ne 'checked'){ $in{'hm'} = '
HTML disabled'; } $buffer =~ s/in\(cgiurl\)/$in{'cgiurl'}/g; $buffer =~ s/in\(imageurl\)/$in{'imageurl'}/g; $buffer =~ s/in\(gid\)/$gid/g; $buffer =~ s/in\(tid\)/$tid/g; $buffer =~ s/in\(fields\)/$fields/; $buffer =~ s/in\(iconstart\)/$iconstart/; $buffer =~ s/in\(iconend\)/$iconend/; $buffer =~ s/in\(smiliestart\)/$smiliestart/; $buffer =~ s/in\(smilieend\)/$smilieend/; $buffer =~ s/in\(am\)/$in{'am'}/; $buffer =~ s/in\(hm\)/$in{'hm'}/; $buffer =~ s/in\(vicode\)/$in{'vicode'}/; $buffer =~ s/in\(html\)/$in{'html'}/g; &ViewOut($buffer,$j); exit; } sub ShowLinksWizard{ my($command,$copt,$cid,$sel,$rurl,$selected); $cid = $in{'cid'}; $command = $in{'command'}; my $line = ""; my $result = ""; require("$basepath/configlib.cgi"); open(DB,"<$datapath/forums.cgi"); while(){ chomp; my($id,$uid,$catname,@rest) = split("\t",$_); ($module)&&(!$admin)&&($uid ne $in{'UserName'})&&(next); (!$cid)&&($cid = $id); if ($id == $cid) { $selected = 'selected'; $in{"CatName"} = $catname; } else{ $selected = ''; } $in{'copt'} .= qq|\n|; } close DB; if(!$in{'copt'}){ if($command eq "slwm"){ print "\n"; dbexit(); } else{ $copt = "\n"; } } else{ ($cid eq 'all')?($sel='selected'):($sel=''); } $cgiurl = $in{'cgiurl'}; $in{'cid'} = $cid; $rurl = $cgiurl; $rurl =~ s/http:\/\/.*?\//\//i; $in{'jcode'} = ""; $in{'ssicode'} = "[an error occurred while processing this directive]"; $in{'phpcode'} = ""; if($command eq "slwm"){ &PageOut("$cgipath/t_linkswizardmod.htm"); } else{ &PageOut("$cgipath/t_linkswizard.htm"); } exit; } sub ViewTopic{ my($orderby,$datesep,$fields,$start,$end,$count,$buffer,$content,$link); require("$basepath/configlib.cgi"); require("$basepath/entrylib.cgi"); my $gid = $in{'gid'}; ($gid =~ /[^\d]/)&&(&PError("Error. Invalid Forum")); my $tid = $in{'tid'}; ($tid =~ /[^\d]/)&&(&PError("Error. Invalid Topic")); my($j) = $in{'j'}; &GetConfig($gid,''); $page = $in{'page'}; (!$page)&&($page = 1); (!$in{"entriesperpage"})&&($in{"entriesperpage"}='25'); $start = ($page*$in{"entriesperpage"})-$in{"entriesperpage"}; $end = $start + $in{"entriesperpage"}; $count=0; $content=''; $buffer=''; $datesep = " "; ($in{"datesep"} eq "1")&&($datesep='-'); ($in{"datesep"} eq "2")&&($datesep='/'); ($in{"datesep"} eq "3")&&($datesep='.'); $dateformat = "\$t[4]$datesep\$t[3]$datesep\$t[5]"; ($in{'dateformat'} == '1')&&($in{'dateformat'} = "\$ts = \"\$t[4]$datesep\$t[3]$datesep\$t[5] \$t[2]:\$t[1]\""); ($in{'dateformat'} == '2')&&($in{'dateformat'} = "\$ts = \"\$t[3]$datesep\$t[4]$datesep\$t[5] \$t[2]:\$t[1]\""); open(DB,"<$datapath/$gid.cgi"); while(){ chomp; my($mtid) = (split("\t",$_))[0]; if($mtid==$tid ){ $content = &PrintRec($_,0,1); } } close DB; my $replies=''; open(DB,"<$datapath/$tid-replies.cgi"); while(){ $count++; if(($count > $start) & ($count <= $end)){ my($status) = (split("\t",$_))[17]; if(!$status){ next; } $replies .= &PrintRec($_,0,2); } } close DB; $link = &GetNlinks($count,$in{"entriesperpage"},$tid); if($link){ $link = "Jump to Page: $link"; } else{ $link=''; } if(!$replies){ $content .= '
'; } else{ $content .= $replies; } (!$npages)&&($npages = '1'); my $mtitle = "$count Entries - Page $page of $npages"; $content = "

Rachel E. Spector
PhD, RN, CTN-A, FAAN
Rachel E. Spector
Retired Lecturer
E-mail: spectorrachel@comcast.net
Website: www.prenhall.com/spector


Biographical Sketch
Rachel E. Spector, PhD, RN, CTN-A, FAAN retired as an associate professor at the William F. Connell Boston College School of Nursing, Chestnut Hill, Massachusetts. Her work focused on developing and teaching models of effective nursing care, "CULTURALCARE", in multicultural populations. She has researched, taught, practiced and consulted in this specialty for over 35 years and is the author of the books Cultural Diversity in Health and Illness, now in its 7th edition; CulturalCare: Guides to Heritage Assessment and Health Traditions; and Las Culturas de la SALUD, published in Spain in 2003. Past and present experiences include numerous lectures and workshops conducted in many parts of the United States and world and the initiation and mounting of the popular exhibit, "Immigrant Health Traditions" at the Ellis Island Immigration Museum. She is a Distinguished Alumna from the Mount Sinai Hospital School of Nursing, a Fellow in the American Academy of Nursing, and a Scholar in Transcultural Nursing. The Massachusetts Association of Registered Nurses, the state organization of the American Nurses' Association, honored her as a "Living Legend" in 2007; in 2008 she was awarded an Honorary Human Rights Award by the American Nurses' Association; and, in 2010 she was appointed a Visiting Distinguished Scholar, Institute for Patient Care, Massachusetts General Hospital, Boston, MA.

Cultural Diversity in Health and Illness, 7th Edition
Rachel E. Spector, PhD, RN, FAAN, CTN-A
Upper Saddle River, NJ: Pearson, 2009

Cultural Diversity in Health and Illness
The purpose of this book is to increase one's knowledge of the dimensions and complexities involved in caring for people from diverse cultural backgrounds. It is an attempt to bring the reader into direct contact with the interaction between providers of care within the North American health care system and the consumers of health care. The staggering issues of health care delivery are explored and contrasted with the choices that people may make in attempting to deal with their personal health care issues.

The major concepts applied to this text are holistic: HEALTH, defined as the balance of the person, both within one's being - physical, mental, and spiritual - and in the outside world - natural, communal, and metaphysical; ILLNESS, the imbalance of the person, both within one's being - physical, mental, and spiritual - and in the outside world - natural, communal, and metaphysical; and HEALING, the restoration of balance, both within one's being - physical, mental, and spiritual - and in the outside world - natural, communal, and metaphysical. The capital letters are used to imply that these terms and others are being used to convey a holistic meaning.

It can be argued that the development of CULTURALCOMPETENCY does not occur in a short encounter with cultural diversity but that it takes time to develop the skills, knowledge, and attitudes to safely and satisfactorily deliver CULTURALCARE - a concept that describes holistic HEALTH care that is culturally sensitive, culturally appropriate, and culturally competent. CULTURALCARE is critical to meeting the complex nursing care needs of a given person, family, and community. It is the provision of health care across cultural boundaries and takes into account the context in which the patient lives as well as the situations in which the patient's health problems arise. CULTURALCOMPETENCY embraces the premise that all things are connected. Each facet discussed in this text - heritage, culture, ethnicity, religion, socialization, and identity - is connected to diversity - demographic change - population, immigration, and poverty. These facets are connected to health/HEALTH, illness/ILLNESS, and curing/HEALING, beliefs and practices, modern and traditional. All of these facets are connected to the health care delivery system - the culture, costs, and politics of health care, the internal and external political issues, public health issues, and housing and other infrastructure issues. In order to fully understand a person's health/HEALTH beliefs and practices, each of these topics must be in the background of a provider's mind.

The way to CULTURALCOMPETENCY is complex; the book depicts five steps to climb to begin to achieve this goal. They are knowing:
  1. Personal heritage - Who are you?? What is your heritage? How deeply do you identify with your traditional heritage? What are your health/HEALTH beliefs, those of your family, and your reference community?


  2. Heritage of others - demographics - Who is the patient, their family, and their reference community? How deeply does a given person identify with their traditional heritage?


  3. Health and HEALTH beliefs and practices - competing philosophies such as allopathic and homeopathic.


  4. Modern health care culture and system - all the issues and problems - including, but limited to the costs and other relevant issues related to modern health care delivery.


  5. Traditional HEALTH Care Systems - The way HEALTH CARE was for most and the way HEALTH CARE still is for many.
Once you have reached the sixth step in the development of CULTURALCOMPETENCY, you are ready to open the door to CULTURALCARE. CULTURALCOMPETENCY is not a "condition" that is rapidly achieved; rather, it is an ongoing process of growth and the development of knowledge that takes a considerable amount of time to ingest, digest, assimilate, circulate, and master. It is now imperative, according to the most recent policies of the Joint Commission of Hospital Accreditation and the Centres for Medicare and Medicaid Services, that ALL health care providers be "culturally competent."

There is a companion website for this book. It contains chapter objectives, chapter outlines, essay questions, multiple choice and matching questions, a CulturalCare Museum, links to countless web resources, a glossary of terms, and links to the New York Times, USA Today, and the Census Bureau. It is available at http://www.prenhall.com/spector/

The tool for conducting the Heritage Assessment is in the text (pp. 365-367) and and may be used as needed. Permission to republish it is easily obtained from the author and publisher. The Heritage Assessment is a way to assess how deeply a given person identifies with their traditional heritage.
#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use strict; use vars qw($dateformat $flop $datapath $mailserver $admin $page $lpage $npages $module $flock %in %cookie $basepath $cgipath $cgiurl $htmlpath $htmlurl $imageurl $imagepath $username $password $imageurl $sendmail); ##################################################################### # csForum - 1.0 - 092209 # ##################################################################### # # # Copyright 1999-2003 CGISCRIPT.NET - All Rights Reserved # # # ##################################################################### # # # THIS COPYRIGHT INFORMATION MUST REMAIN INTACT # # AND MAY NOT BE MODIFIED IN ANY WAY # # # ##################################################################### # # When you downloaded this script you agreed to accept the terms # of this Agreement. This Agreement is a legal contract, which # specifies the terms of the license and warranty limitation between # you and CGISCRIPT.NET. You should carefully read the following # terms and conditions before installing or using this software. # Unless you have a different license agreement obtained from # CGISCRIPT.NET, installation or use of this software indicates # your acceptance of the license and warranty limitation terms # contained in this Agreement. If you do not agree to the terms of this # Agreement, promptly delete and destroy all copies of the Software. # # Versions of the Software # Only one copy of the registered version of CGISCRIPT.NET # may used on one web site. # # License to Redistribute # Distributing the software and/or documentation with other products # (commercial or otherwise) or by other than electronic means without # CGISCRIPT.NET's prior written permission is forbidden. # All rights to the CGISCRIPT.NET software and documentation not expressly # granted under this Agreement are reserved to CGISCRIPT.NET. # # Disclaimer of Warranty # THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND # WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER # WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE # AND SOFTWARE ENVIRONMENTS INTO WHICH CGISCRIPT.NET MAY BE USED, NO WARRANTY # OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE # ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF CGISCRIPT.NET WILL BE # LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE. # IN NO CASE SHALL CGISCRIPT.NET BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR # CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS # OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE # BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT, # NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF # CGISCRIPT.NET IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL # CGISCRIPT.NET' LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID # BY LICENSEE TO CGISCRIPT.NET. # # Credits: # Andy Angrick - Programmer - angrick@cgiscript.net # Mike Barone - Design - mbarone@cgiscript.net # # For information about this script or other scripts see # http://www.cgiscript.net # # Thank you for trying out our script. # If you have any suggestions or ideas for a new innovative script # please direct them to suggest@cgiscript.net. Thanks. # ######################################################################## $basepath = "./"; $module=0; $admin=0; $flock=1; $in{'scriptname'} = 'csForum.cgi'; require("$basepath/libs.cgi"); if(-f "$basepath/setup.cgi"){ require("$basepath/setup.cgi"); } $in{'imageurl'} = $imageurl; $in{'cgiurl'} = $cgiurl.'/'.$in{'scriptname'}; if($cgiurl =~ /\/mod/){ $module=1; } else{ $module=0; } &main; sub main{ &GetCookies; &getdata; my $command = $in{'command'}; ($command eq "downloademails")&&(&DownloadEmails); print "Content-type: text/html; charset=ISO-8859-1\n\n"; if((! -e "$basepath/setup.cgi") && (! -e "../setup.cgi") && ($in{'command'} eq "")){ &DoSetup; } if($in{'command'} eq "savesetup"){ if(-e "$basepath/setup.cgi"){ PError("Error. Permission denied."); } else{ &SaveSetup; } } ($command eq "login")&&(&DoLogin); ($command eq "view")&&(&View); ($command eq "vt")&&(&ViewTopic); ($command eq "sa")&&(&ShowAddG); ($command eq "sar")&&(&ShowAddG); ($command eq "padd")&&(&PAdd); ($command eq "sf")&&(&ShowForums); ($command eq "")&&(&DoLogin); ($module)?(&GetLoginMod):(&GetLogin); ($command eq "manage")&&(&Manage); ($command eq "showedit")&&(&ShowEdit); ($command eq "showeditp")&&(&ShowEditP); ($command eq "savechanges")&&(&SaveChanges); ($command eq "delete")&&(&Delete); ($command eq "deletep")&&(&DeleteP); ($command eq "showaddc")&&(&ShowAddC); ($command eq "showeditc")&&(&ShowEditC); ($command eq "addc")&&(&AddC); ($command eq "savechangesc")&&(&SaveChangesC); ($command eq "deletec")&&(&DeleteC); ($command eq "slw")&&(&ShowLinksWizard); ($command eq "slwm")&&(&ShowLinksWizard); ($command eq "scp")&&(&ShowCP); ($command eq "cp")&&(&ChangePassword); ($command eq "approve")&&(&Approve('1')); ($command eq "disable")&&(&Approve('0')); ($command eq "approvep")&&(&ApproveP('1')); ($command eq "disablep")&&(&ApproveP('0')); ($command eq "getstemplate")&&(&GetTemplate(1)); ($command eq "gettemplate")&&(&GetTemplate(2)); ($command eq "getbwf")&&(&GetBWF()); } sub GetBWF{ my($type) = @_; my ($tmp,$buffer); open(FILE, "<$datapath/bwf.csv"); while(){ $buffer .= $_; } close FILE; $buffer = &htmlspecialchars($buffer); print "
"; print "\n"; exit; } sub GetTemplate{ my($type) = @_; my ($tmp,$buffer); my $wt = $in{'wt'}; if($type==1){ if($wt==1){ $tmp = 't_public_add.htm'; } if($wt==2){ $tmp = 't_public_add_2.htm'; } if($wt==3){ $tmp = 't_public_add_3.htm'; } } else{ if($wt==1){ $tmp = 't_public_view.htm'; } if($wt==2){ $tmp = 't_public_view_2.htm'; } if($wt==3){ $tmp = 't_public_view_3.htm'; } } open(FILE, "<$cgipath/$tmp"); while(){ $buffer .= $_; } close FILE; $buffer = &htmlspecialchars($buffer); print "
"; print "\n"; exit; } sub DownloadEmails{ ($module)?(&GetLoginMod):(&GetLogin); my $gid = $in{'gid'}; my($line,@l,%emails); open(DB,"<$datapath/$gid.cgi"); while(){ my(@f) = split("\t",$_); next if (!$f[5]); $emails{$f[5]} = 1; } close DB; foreach my $i (sort keys %emails){ push(@l,qq|"$i"|); } $line = join("\r\n",@l); my $mylen = length($line); print "Content-type: application/msexcel\n"; print "Content-disposition: inline; filename=\"export.csv\"\n"; print "Content-length: $mylen\n\n"; print $line; exit; } sub PAdd{ my $gid = $in{'gid'}; my $tid = $in{'tid'}; my $rm = $in{'rm'}; (!$gid)&&(PError("Error. Invalid Forum")); ($gid =~ /[^\d]/)&&(PError("Error. Invalid Forum")); ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Topic")); require("$basepath/configlib.cgi"); &GetConfig($gid,''); require("$basepath/entrylib.cgi"); &GetFormVars; if($in{'usevi'}){ require("$basepath/checkauth.cgi"); &CheckAuth(); } $in{'badips'} =~ s/\\n/\n/g; $in{'badwords'} =~ s/\\n/\n/g; if($in{'badips'}){ $in{'badips'} = &reverseHTML($in{'badips'}); my($ip) = $ENV{'REMOTE_ADDR'}; $in{'badips'} =~ s/\r//g; my(@lines) = split("\n",$in{'badips'}); foreach my $i (@lines){ if($i eq $ip){ &PError("Error. Your IP address has been blocked from signing this forum."); } } } if($in{'badwords'}){ $in{'badwords'} = &reverseHTML($in{'badwords'}); my($badphrase) = &reverseHTML($in{'badphrase'}); $in{'badwords'} =~ s/\r//g; my(@lines) = split("\n",$in{'badwords'}); foreach my $i (@lines){ if($i){ $in{'message'} =~ s/\b$i\b/$badphrase/g; $in{'gname'} =~ s/\b$i\b/$badphrase/g; $in{'email'} =~ s/\b$i\b/$badphrase/g; $in{'c1v'} =~ s/\b$i\b/$badphrase/g; $in{'c2v'} =~ s/\b$i\b/$badphrase/g; $in{'c3v'} =~ s/\b$i\b/$badphrase/g; $in{'c4v'} =~ s/\b$i\b/$badphrase/g; $in{'c5v'} =~ s/\b$i\b/$badphrase/g; $in{'c6v'} =~ s/\b$i\b/$badphrase/g; $in{'c7v'} =~ s/\b$i\b/$badphrase/g; $in{'c8v'} =~ s/\b$i\b/$badphrase/g; $in{'c9v'} =~ s/\b$i\b/$badphrase/g; $in{'c10v'} =~ s/\b$i\b/$badphrase/g; } } } ($in{'approvesub'} eq 'checked')?($in{'status'}='0'):($in{'status'}='1'); $in{'uname'} = $in{'UserName'}; $in{'gid'} = $gid; &AddNewEntry; if($in{'approvesub'} eq 'checked'){ &SendApproval; } if($in{'emailnotification'} eq 'checked'){ &SendNotify; } if($in{'sendauto'} eq 'checked'){ &SendAuto; } my($mmess); if($in{'approvesub'} eq 'checked'){ $mmess = "Your submission has been sent to the administrator for approval"; } $in{'lastread'}=time; $in{'gname'} = &htmlspecialchars($in{'gname'}); $in{'email'} = &htmlspecialchars($in{'email'}); $in{'c1'} = &htmlspecialchars($in{'c1'}); $in{'c2'} = &htmlspecialchars($in{'c2'}); $in{'c3'} = &htmlspecialchars($in{'c3'}); $in{'c4'} = &htmlspecialchars($in{'c4'}); $in{'c5'} = &htmlspecialchars($in{'c5'}); $in{'c6'} = &htmlspecialchars($in{'c6'}); $in{'c7'} = &htmlspecialchars($in{'c7'}); $in{'c8'} = &htmlspecialchars($in{'c8'}); $in{'c9'} = &htmlspecialchars($in{'c9'}); $in{'c10'} = &htmlspecialchars($in{'c10'}); &PageOut("$cgipath/t_add_thanks.htm"); exit; } sub SendAuto{ my($message)=''; $in{'message'} =~ s/\\n/\n/g; if($in{'smess'}){ $message = $in{'amessage'}; } if($in{'incsub'}){ $message .= "\n\nYou submitted the following information:\n\n"; ($in{'gname'})&&($message .= "Name: ".$in{'gname'}."\n"); ($in{'email'})&&($message .= "Email: ".$in{'email'}."\n"); if($in{'subject'}){ $message .= "Subject: ".$in{'subject'}."\n"; } else{ my $subject=&GetTopicName(); $message .= "Topic: ".$subject."\n"; } ($in{'c1v'})&&($message .= $in{'c1'}.": ".$in{'c1v'}."\n"); ($in{'c2v'})&&($message .= $in{'c2'}.": ".$in{'c2v'}."\n"); ($in{'c3v'})&&($message .= $in{'c3'}.": ".$in{'c3v'}."\n"); ($in{'c4v'})&&($message .= $in{'c4'}.": ".$in{'c4v'}."\n"); ($in{'c5v'})&&($message .= $in{'c5'}.": ".$in{'c5v'}."\n"); ($in{'c6v'})&&($message .= $in{'c6'}.": ".$in{'c6v'}."\n"); ($in{'c7v'})&&($message .= $in{'c7'}.": ".$in{'c7v'}."\n"); ($in{'c8v'})&&($message .= $in{'c8'}.": ".$in{'c8v'}."\n"); ($in{'c9v'})&&($message .= $in{'c9'}.": ".$in{'c9v'}."\n"); ($in{'c10v'})&&($message .= $in{'c10'}.": ".$in{'c10v'}."\n"); $message .="\nYour Message: \n".$in{'message'}."\n\n"; } if($sendmail){ open(MAIL,"|$sendmail -t"); print MAIL "To: ".$in{'email'}."\n"; print MAIL "From: ".$in{'afrom'}."\n"; print MAIL "Subject: ".$in{'asubject'}."\n"; print MAIL $message; close MAIL; } else{ require("$basepath/sendmail.cgi"); &SendMail($in{'email'},$in{'afrom'},$in{'asubject'},$message,$mailserver); } } sub SendNotify{ my($message)=''; $in{'message'} =~ s/\\n/\n/g; $message .= "The following information was submitted to forum ".$in{'name'}.":\n\n"; ($in{'gname'})&&($message .= "Name: ".$in{'gname'}."\n"); ($in{'email'})&&($message .= "Email: ".$in{'email'}."\n"); if($in{'subject'}){ $message .= "Subject: ".$in{'subject'}."\n"; } else{ my $subject=&GetTopicName(); $message .= "Topic: ".$subject."\n"; } ($in{'c1v'})&&($message .= $in{'c1'}.": ".$in{'c1v'}."\n"); ($in{'c2v'})&&($message .= $in{'c2'}.": ".$in{'c2v'}."\n"); ($in{'c3v'})&&($message .= $in{'c3'}.": ".$in{'c3v'}."\n"); ($in{'c4v'})&&($message .= $in{'c4'}.": ".$in{'c4v'}."\n"); ($in{'c5v'})&&($message .= $in{'c5'}.": ".$in{'c5v'}."\n"); ($in{'c6v'})&&($message .= $in{'c6'}.": ".$in{'c6v'}."\n"); ($in{'c7v'})&&($message .= $in{'c7'}.": ".$in{'c7v'}."\n"); ($in{'c8v'})&&($message .= $in{'c8'}.": ".$in{'c8v'}."\n"); ($in{'c9v'})&&($message .= $in{'c9'}.": ".$in{'c9v'}."\n"); ($in{'c10v'})&&($message .= $in{'c10'}.": ".$in{'c10v'}."\n"); my($email) = ''; ($in{'email'})?($email = $in{'email'}):($email = $in{'emailwho'}); $message .="\nMessage: \n".$in{'message'}."\n\n"; if($sendmail){ open(MAIL,"|$sendmail -t"); print MAIL "To: ".$in{'emailwho'}."\n"; print MAIL "From: $email\n"; print MAIL "Subject: Forum Submission Notification\n"; print MAIL $message; close MAIL; } else{ require("$basepath/sendmail.cgi"); &SendMail($in{'emailwho'},$email,'Forum Submission Notification',$message,$mailserver); } } sub SendApproval{ my($message) =''; $message .= "The following information is waiting for approval in forum ".$in{'name'}.":\n\n"; ($in{'gname'})&&($message .= "Name: ".$in{'gname'}."\n"); ($in{'email'})&&($message .= "Email: ".$in{'email'}."\n"); if($in{'subject'}){ $message .= "Subject: ".$in{'subject'}."\n"; } else{ my $subject=&GetTopicName(); $message .= "Topic: ".$subject."\n"; } ($in{'c1v'})&&($message .= $in{'c1'}.": ".$in{'c1v'}."\n"); ($in{'c2v'})&&($message .= $in{'c2'}.": ".$in{'c2v'}."\n"); ($in{'c3v'})&&($message .= $in{'c3'}.": ".$in{'c3v'}."\n"); ($in{'c4v'})&&($message .= $in{'c4'}.": ".$in{'c4v'}."\n"); ($in{'c5v'})&&($message .= $in{'c5'}.": ".$in{'c5v'}."\n"); ($in{'c6v'})&&($message .= $in{'c6'}.": ".$in{'c6v'}."\n"); ($in{'c7v'})&&($message .= $in{'c7'}.": ".$in{'c7v'}."\n"); ($in{'c8v'})&&($message .= $in{'c8'}.": ".$in{'c8v'}."\n"); ($in{'c9v'})&&($message .= $in{'c9'}.": ".$in{'c9v'}."\n"); ($in{'c10v'})&&($message .= $in{'c10'}.": ".$in{'c10v'}."\n"); my($email)=''; ($in{'email'})?($email = $in{'email'}):($email = $in{'aemailwho'}); $message .="\nMessage: \n".$in{'message'}."\n\n"; $message .= "Click here to enter management: \n"; $message .= "$in{'cgiurl'}?command=login\n"; if($sendmail){ open(MAIL,"|$sendmail -t"); print MAIL "To: ".$in{'aemailwho'}."\n"; print MAIL "From: $email\n"; print MAIL "Subject: Forum Approval Notification\n"; print MAIL $message; close MAIL; } else{ require("$basepath/sendmail.cgi"); &SendMail($in{'aemailwho'},$email,'Forum Approval Notification',$message,$mailserver); } } sub ShowAddG{ require("$basepath/configlib.cgi"); require("$basepath/entrylib.cgi"); my($fields,$buffer,$j,$iconstart,$iconend,$smiliestart,$smilieend); my $gid = $in{'gid'}; (!$gid)&&(&PError("Error. Invalid Forum")); ($gid =~ /[^\d]/)&&(&PError("Error. Invalid Forum")); my $tid = $in{'tid'}; if($in{'command'} eq 'sar'){ (!$tid)&&(&PError("Error. Invalid Forum")); ($tid =~ /[^\d]/)&&(&PError("Error. Invalid Topic")); } &GetConfig($gid,''); if($in{'usevi'}){ my $rnd = rand(1000); $in{'vicode'} = qq|Verify Authentication Code:  |; } my $name = $cookie{'name'}; my $email = $cookie{'email'}; my $c1 = $cookie{'c1'}; my $c2 = $cookie{'c2'}; my $c3 = $cookie{'c3'}; my $c4 = $cookie{'c4'}; my $c5 = $cookie{'c5'}; my $c6 = $cookie{'c6'}; my $c7 = $cookie{'c7'}; my $c8 = $cookie{'c8'}; my $c9 = $cookie{'c9'}; my $c10 = $cookie{'c10'}; my $rn=''; #subject field if($in{'command'} eq 'sa'){ $fields .= "
* Subject:
* Name: $mess
* Email: $mess
$rn ".$in{'c1'}.": $mess
$rn ".$in{'c2'}.": $mess
$rn ".$in{'c3'}.": $mess
$rn ".$in{'c4'}.": $mess
$rn ".$in{'c5'}.": $mess
$rn ".$in{'c6'}.": $mess
$rn ".$in{'c7'}.": $mess
$rn ".$in{'c8'}.": $mess
$rn ".$in{'c9'}.": $mess
$rn ".$in{'c10'}.": $mess
No entries
$content
"; $content .= "
$link
"; $content .= "
$mtitle
"; print $content; exit; } sub ShowForums{ my($gid,@f,$found,%forum,$orderby,$datesep,$fields,$start,$end,$count,$buffer,$content,$link); $found=0; open(DB,"<$datapath/forums.cgi"); while(){ chomp; @f = split("\t",$_); $forum{$f[2]} = $f[0]; } close DB; my($flop,$rowclass); foreach my $i (sort keys %forum){ my $fid = $forum{$i}; if(!$flop){ $flop = 1; $rowclass = 'evenrow'; } else{ $flop = 0; $rowclass = 'oddrow'; } $content .= "
$i
No entries
$content
"; open(FILE,"<$cgipath/t_public_view.htm"); while(){ $buffer .= $_; } close FILE; $in{'addform'} = qq| |; $in{'lastread'} = time; $buffer =~ s/in\(lastread\)/$in{'lastread'}/g; $buffer =~ s/in\(cgiurl\)/$in{'cgiurl'}/g; $buffer =~ s/in\(imageurl\)/$in{'imageurl'}/g; $buffer =~ s/in\(gid\)/$gid/g; $buffer =~ s/in\(fields\)/$fields/g; $buffer =~ s/in\(mtitle\)/$mtitle/g; $buffer =~ s/in\(content\)/$content/g; $buffer =~ s/in\(link\)/$link/g; $buffer =~ s/in\(name\)/$in{'name'}/g; $buffer =~ s/in\(addform\)/$in{'addform'}/g; if(($in{'dela'})&&($in{'dge'} > 0)){ &DoExpire; } &ViewOut($buffer); exit; } sub View{ my($orderby,$datesep,$fields,$start,$end,$count,$buffer,$content,$link); require("$basepath/configlib.cgi"); require("$basepath/entrylib.cgi"); my $gid = $in{'gid'}; ($gid =~ /[^\d]/)&&(&PError("Error. Invalid Forum")); my($j) = $in{'j'}; &GetConfig($gid,''); $page = $in{'page'}; (!$page)&&($page = 1); (!$in{"entriesperpage"})&&($in{"entriesperpage"}='25'); $start = ($page*$in{"entriesperpage"})-$in{"entriesperpage"}; $end = $start + $in{"entriesperpage"}; $count=0; $content=''; $buffer=''; $datesep = " "; ($in{"datesep"} eq "1")&&($datesep='-'); ($in{"datesep"} eq "2")&&($datesep='/'); ($in{"datesep"} eq "3")&&($datesep='.'); $dateformat = "\$t[4]$datesep\$t[3]$datesep\$t[5]"; ($in{'dateformat'} == '1')&&($in{'dateformat'} = "\$ts = \"\$t[4]$datesep\$t[3]$datesep\$t[5] \$t[2]:\$t[1]\""); ($in{'dateformat'} == '2')&&($in{'dateformat'} = "\$ts = \"\$t[3]$datesep\$t[4]$datesep\$t[5] \$t[2]:\$t[1]\""); open(DB,"<$datapath/$gid.cgi"); while(){ chomp; my($status) = (split("\t",$_))[17]; if(!$status){ next; } $count++; if(($count > $start) & ($count <= $end)){ $content .= &PrintRec($_,0); } } close DB; $link = &GetNlinks($count,$in{"entriesperpage"}); if($link){ $link = "Jump to Page: $link"; } else{ $link=''; } (!$content)&&($content = '
No entries
$content
"; if($in{'a'} == 1){ $content .= "
$link
"; $content .= "
$mtitle
"; print $content; exit; } &DoAddForm; if(-f "$datapath/$in{'gid'}-tv.htm"){ open(FILE,"<$datapath/$in{'gid'}-tv.htm"); while(){ $buffer .= $_; } close FILE; } else{ open(FILE,"<$cgipath/t_public_view.htm"); while(){ $buffer .= $_; } close FILE; } $in{'lastread'} = time; $buffer =~ s/in\(lastread\)/$in{'lastread'}/g; $buffer =~ s/in\(cgiurl\)/$in{'cgiurl'}/g; $buffer =~ s/in\(imageurl\)/$in{'imageurl'}/g; $buffer =~ s/in\(gid\)/$gid/g; $buffer =~ s/in\(fields\)/$fields/g; $buffer =~ s/in\(mtitle\)/$mtitle/g; $buffer =~ s/in\(content\)/$content/g; $buffer =~ s/in\(link\)/$link/g; $buffer =~ s/in\(name\)/$in{'name'}/g; $buffer =~ s/in\(addform\)/$in{'addform'}/g; if(($in{'dela'})&&($in{'dge'} > 0)){ &DoExpire; } &ViewOut($buffer); exit; } sub DoExpire{ my $id = $in{'id'}; my $gid = $in{'gid'}; my(@f,@l); my $ts = time; open(DB,"+<$datapath/$in{'gid'}.cgi"); ($flock)&&(flock(DB,2)); while(){ my(@r) = split("\t",$_); my($nt) = $r[2] + ($in{'dge'} * 86400); if($nt >= $ts){ push(@l,$_); } } seek(DB,0,0); if(@l){ foreach my $i (@l){ print DB $i; } truncate(DB, tell(DB)); } ($flock)&&(flock(DB,8)); close DB; } sub ViewOut{ my($content) = @_; if($in{'j'} != 1){ print $content; } else{ $content =~ s/\r//g; my(@lines) = split("\n",$content); foreach my $i (@lines){ $i =~ s/\r//g; $i =~ s/\"/\\"/g; $i =~ s/\\n/\\\\n/g; $i =~ s/(scr)(ipt)/$1\"\+\"$2/gsi; print "document.write(\"$i\\n\");\n"; } } exit; } sub SaveChangesC{ my $id = $in{'id'}; require("$basepath/configlib.cgi"); GetFormConfigVars(); $in{'uname'} = $in{'UserName'}; &SaveConfig($id); &Redirect($in{'cgiurl'}."?command=manage&gid=$in{'id'}","Changes Saved"); exit; } sub SaveChanges{ my($id) = $in{'id'}; (!$id)&&(PError("No record selected to edit")); my $id = $in{'id'}; my $gid = $in{'gid'}; my $tid = $in{'tid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; ($id)&&($id =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($gid)&&($gid =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Post ID.")); ($page)&&($page =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); ($lpage)&&($lpage =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); require("$basepath/entrylib.cgi"); require("$basepath/configlib.cgi"); &GetConfig($gid,''); &GetFormVars; &SaveChangesEntry($id,$tid); &Redirect($in{'cgiurl'}."?command=manage&tid=$tid&gid=$gid&page=$page&lpage=$lpage","Changes Saved"); exit; } sub ShowEditP{ my $id = $in{'id'}; my $gid = $in{'gid'}; my $tid = $in{'tid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; ($id)&&($id =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($gid)&&($gid =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Post ID.")); ($page)&&($page =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); ($lpage)&&($lpage =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); my $found = 0; my ($fld); require("$basepath/entrylib.cgi"); require("$basepath/configlib.cgi"); &GetConfig($gid,''); open(DB,"<$datapath/$tid-replies.cgi"); while(){ my(@f) = split("\t",$_); if($f[0] == $id){ $found=1; $fld = $_; last; } } close DB; if(!$found){ &PError("Error. No record found"); } &GetOneRec($fld); if($in{'namereq'} == 'checked'){ $in{'fields'} .= "Name: \n"; } if($in{'emailreq'} == 'checked'){ $in{'fields'} .= "Email: \n"; } &PageOut("$cgipath/t_edit_entry.htm"); exit; } sub ShowEdit{ my $id = $in{'id'}; my $gid = $in{'gid'}; my $found = 0; my ($fld); require("$basepath/entrylib.cgi"); require("$basepath/configlib.cgi"); &GetConfig($gid,''); open(DB,"<$datapath/$gid.cgi"); while(){ my(@f) = split("\t",$_); if($f[0] == $id){ $found=1; $fld = $_; last; } } close DB; if(!$found){ &PError("Error. No record found"); } &GetOneRec($fld); #subject field $in{'fields'} .= "* Subject: \n"; if($in{'namereq'} == 'checked'){ $in{'fields'} .= "Name: \n"; } if($in{'emailreq'} == 'checked'){ $in{'fields'} .= "Email: \n"; } if(($in{'c1a'} == 'checked')&&($in{'c1'})){ $in{'fields'} .= "".$in{'c1'}.": \n"; } if(($in{'c2a'} == 'checked')&&($in{'c2'})){ $in{'fields'} .= "".$in{'c2'}.": \n"; } if(($in{'c3a'} == 'checked')&&($in{'c3'})){ $in{'fields'} .= "".$in{'c3'}.": \n"; } if(($in{'c4a'} == 'checked')&&($in{'c4'})){ $in{'fields'} .= "".$in{'c4'}.": \n"; } if(($in{'c5a'} == 'checked')&&($in{'c5'})){ $in{'fields'}.= "".$in{'c5'}.": \n"; } if(($in{'c6a'} == 'checked')&&($in{'c6'})){ $in{'fields'} .= "".$in{'c6'}.": \n"; } if(($in{'c7a'} == 'checked')&&($in{'c7'})){ $in{'fields'} .= "".$in{'c7'}.": \n"; } if(($in{'c8a'} == 'checked')&&($in{'c8'})){ $in{'fields'} .= "".$in{'c8'}.": \n"; } if(($in{'c9a'} == 'checked')&&($in{'c9'})){ $in{'fields'} .= "".$in{'c9'}.": \n"; } if(($in{'c10a'} == 'checked')&&($in{'c10'})){ $in{'fields'} .= "".$in{'c10'}.": \n"; } ($in{'icon'} == 1)&&($in{'icon1'}='checked'); ($in{'icon'} == 2)&&($in{'icon2'}='checked'); ($in{'icon'} == 3)&&($in{'icon3'}='checked'); ($in{'icon'} == 4)&&($in{'icon4'}='checked'); ($in{'icon'} == 5)&&($in{'icon5'}='checked'); ($in{'icon'} == 6)&&($in{'icon6'}='checked'); ($in{'icon'} == 7)&&($in{'icon7'}='checked'); ($in{'icon'} == 8)&&($in{'icon8'}='checked'); ($in{'icon'} == 9)&&($in{'icon9'}='checked'); ($in{'icon'} == 10)&&($in{'icon10'}='checked'); ($in{'icon'} == 11)&&($in{'$icon11'}='checked'); ($in{'icon'} == 12)&&($in{'icon12'}='checked'); if($in{'dui'} eq 'checked'){ $in{'duis'} = ''; } if($in{'docatalog'} eq 'checked'){ $in{'smis'} = ''; } else{ $in{'am'} = '(click icons below to add within message at cursor)'; } &PageOut("$cgipath/t_edit_entry.htm"); exit; } sub ShowEditC{ $in{'command'} = 'savechangesc'; my $id= $in{'id'}; require("$basepath/configlib.cgi"); &GetConfig($id,''); $in{'template'} = &htmlspecialchars($in{'template'}); $in{'stemplate'} = &htmlspecialchars($in{'stemplate'}); &PageOut("$basepath/t_configure.htm"); exit; } sub ApproveP{ my($status) = @_; my $id = $in{'id'}; my $gid = $in{'gid'}; my $tid = $in{'tid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; ($id)&&($id =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($gid)&&($gid =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Post ID.")); ($page)&&($page =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); ($lpage)&&($lpage =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); my(@f,@l); open(DB,"$datapath/$in{'gid'}.cgi"); while(){ chomp; @f = split("\t",$_); if($f[0] == $id){ last; } } close DB; if((!$admin)&&($f[1] ne $in{'UserName'})){ &PError("Error. Permission denied"); } open(DB,"+<$datapath/$tid-replies.cgi"); ($flock)&&(flock(DB,2)); while(){ my(@r) = split("\t",$_); if($r[0] ne $id){ push(@l,$_); } else{ $r[17] = $status; my $newentry = join("\t",@r); push(@l,"$newentry"); } } seek(DB,0,0); if(@l){ foreach my $i (@l){ print DB $i; } truncate(DB, tell(DB)); } ($flock)&&(flock(DB,8)); close DB; Redirect($in{'cgiurl'}."?command=manage&gid=$gid&tid=$tid&page=$page&lpage=$lpage","Entry Saved"); exit; } sub Approve{ my($status) = @_; my $id = $in{'id'}; my $gid = $in{'gid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; my(@f,@l); open(DB,"$datapath/$in{'gid'}.cgi"); while(){ chomp; @f = split("\t",$_); if($f[0] == $id){ last; } } close DB; if((!$admin)&&($f[1] ne $in{'UserName'})){ &PError("Error. Permission denied"); } $f[17] = $status; my $newentry = join("\t",@f); open(DB,"+<$datapath/$in{'gid'}.cgi"); ($flock)&&(flock(DB,2)); while(){ my(@r) = split("\t",$_); if($r[0] ne $id){ push(@l,$_); } else{ push(@l,"$newentry\n"); } } seek(DB,0,0); if(@l){ foreach my $i (@l){ print DB $i; } truncate(DB, tell(DB)); } ($flock)&&(flock(DB,8)); close DB; Redirect($in{'cgiurl'}."?command=manage&gid=$gid&page=$page&lpage=$lpage","Status Updated"); exit; } sub DeleteP{ my $id = $in{'id'}; my $gid = $in{'gid'}; my $tid = $in{'tid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; ($id)&&($id =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($gid)&&($gid =~ /[^\d]/)&&(PError("Error. Invalid Topic ID.")); ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Post ID.")); ($page)&&($page =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); ($lpage)&&($lpage =~ /[^\d]/)&&(PError("Error. Invalid Page ID.")); my(@f,@l); open(DB,"$datapath/$in{'gid'}.cgi"); while(){ chomp; @f = split("\t",$_); if($f[0] == $id){ last; } } close DB; if((!$admin)&&($f[1] ne $in{'UserName'})){ &PError("Error. Permission denied"); } open(DB,"+<$datapath/$tid-replies.cgi"); ($flock)&&(flock(DB,2)); while(){ my(@r) = split("\t",$_); if($r[0] ne $id){ push(@l,$_); } } seek(DB,0,0); foreach my $i (@l){ print DB $i; } truncate(DB, tell(DB)); ($flock)&&(flock(DB,8)); close DB; Redirect($in{'cgiurl'}."?command=manage&gid=$gid&tid=$tid&page=$page&lpage=$lpage","Entry Deleted"); exit; } sub Delete{ my $id = $in{'id'}; my $gid = $in{'gid'}; my $page = $in{'page'}; my $lpage = $in{'lpage'}; my(@f,@l); open(DB,"$datapath/$in{'gid'}.cgi"); while(){ chomp; @f = split("\t",$_); if($f[0] == $id){ last; } } close DB; if((!$admin)&&($f[1] ne $in{'UserName'})){ &PError("Error. Permission denied"); } open(DB,"+<$datapath/$in{'gid'}.cgi"); ($flock)&&(flock(DB,2)); while(){ my(@r) = split("\t",$_); if($r[0] ne $id){ push(@l,$_); } } seek(DB,0,0); foreach my $i (@l){ print DB $i; } truncate(DB, tell(DB)); ($flock)&&(flock(DB,8)); close DB; Redirect($in{'cgiurl'}."?command=manage&gid=$gid&page=$page&lpage=$lpage","Entry Deleted"); exit; } sub DeleteC{ my $gid = $in{'gid'}; (!$gid)&&(PError("Error. No Forum selected")); require("$basepath/configlib.cgi"); &DeleteConfig($gid); Redirect($in{'cgiurl'}."?command=manage","Forum Deleted"); exit; } sub AddC{ require("$basepath/configlib.cgi"); &GetFormConfigVars(); $in{'uname'} = $in{'UserName'}; my $gid = &AddNewConfig; Redirect($in{'cgiurl'}."?command=manage&gid=$gid","Forum Added"); exit; } sub ShowAddC{ require("$basepath/configlib.cgi"); &ClearConfig; $in{'command'} = 'addc'; $in{'gid'}=''; &PageOut("$cgipath/t_configure.htm"); exit; } sub Manage{ my($gid,$cid,$line,$count,$content,$datesep,$catId,$selected,$tid); $gid = $in{'gid'}; $tid = $in{'tid'}; ($tid)&&($tid =~ /[^\d]/)&&(PError("Error. Invalid Post ID.")); ($gid =~ /[^\d]/)&&(PError("Error. Invalid topic ID.")); require("$basepath/configlib.cgi"); require("$basepath/entrylib.cgi"); open(DB,"<$datapath/forums.cgi"); while(){ chomp; my($id,$uid,$catname,@rest) = split("\t",$_); ($module)&&(!$admin)&&($uid ne $in{'UserName'})&&(next); (!$gid)&&($gid = $id); if ($id == $gid) { $selected = 'selected'; $in{"CatName"} = $catname; } else{ $selected = ''; } $in{'copt'} .= qq|\n|; } close DB; (!$in{'copt'})&&($in{'copt'} = "\n"); $in{'CatName'} = &htmlspecialchars($in{"CatName"}); &GetConfig($gid,''); $page=''; $page = $in{'page'}; (!$page)&&($page = 1); (!$in{'entriesperpage'})&&($in{'entriesperpage'}='25'); my $start = ($page*$in{'entriesperpage'})-$in{'entriesperpage'}; my $end = $start + $in{'entriesperpage'}; $count=0; $datesep = " "; ($in{"datesep"} eq "1")&&($datesep='-'); ($in{"datesep"} eq "2")&&($datesep='/'); ($in{"datesep"} eq "3")&&($datesep='.'); $dateformat = "\$t[4]$datesep\$t[3]$datesep\$t[5]"; ($in{'dateformat'} == '1')&&($in{'dateformat'} = "\$ts = \"\$t[4]$datesep\$t[3]$datesep\$t[5]\""); ($in{'dateformat'} == '2')&&($in{'dateformat'} = "\$ts = \"\$t[3]$datesep\$t[4]$datesep\$t[5]\""); if(!$tid){ open(DB,"<$datapath/$gid.cgi"); while(){ $count++; if(($count > $start) & ($count <= $end)){ $in{'line'} .= &PrintRec($_,1); } } close DB; (!$in{'line'})&&($in{'line'} = 'No entries submitted'); $in{'link'} = &GetNlinksMan($count,$in{'entriesperpage'},$gid); (!$in{'link'})&&($in{'link'}='1'); } else{ open(DB,"<$datapath/$gid.cgi"); while(){ chomp; my($status) = (split("\t",$_))[17]; my($mtid) = (split("\t",$_))[0]; if($mtid==$tid ){ $content = &PrintRec($_,1,3); } } close DB; $content .= qq| Actions Posts(s) |; my $replies=''; open(DB,"<$datapath/$tid-replies.cgi"); while(){ $count++; if(($count > $start) & ($count <= $end)){ $replies .= &PrintRec($_,1,4); } } close DB; if(!$replies){ $in{'link'} =''; $content .= 'No entries submitted'; } else{ $in{'link'} = &GetNlinksMan($count,$in{"entriesperpage"},$gid,$tid); $content .= $replies; } $in{'line'} = $content; } $in{'cp'}=''; if($admin){ $in{'cp'} = " "; } (!$in{'link'})&&($in{'link'} = '0'); (!$npages)&&($npages='1'); $in{'mtitle'} = $in{'name'}." :: $count Entries - $npages Pages"; $in{'gid'} = $gid; &PageOut("$cgipath/t_manage.htm"); exit; } sub reverseHTML{ my($text) = @_; $text =~ s/\>/>/g; $text =~ s/\</$basepath/setup.cgi"); print SETUP "\$cgiurl='$in{'mcgiurl'}';\n"; print SETUP "\$cgipath='$in{'mcgipath'}';\n"; print SETUP "\$imageurl='$in{'mimageurl'}';\n"; print SETUP "\$imagepath='$in{'mimagepath'}';\n"; print SETUP "\$datapath='$in{'mdatapath'}';\n"; print SETUP "\$sendmail='$in{'msendmail'}';\n"; print SETUP "\$username='$in{'musername'}';\n"; print SETUP "\$password='$in{'mpassword'}';\n"; print SETUP "1;\n"; &Redirect("$ENV{'SCRIPT_NAME'}?command=login","Setup.cgi reconfigured"); exit; } sub ChangePassword{ my($buff,$encpass); (!$in{'musername'})&&(&PError("Error. Please enter a username")); (!$in{'mpassword'})&&(&PError("Error. Please enter a password")); ($in{'mpassword'} ne $in{'mpassword2'})&&(&PError("Error. Please retype passwords")); ($in{'musername'} =~ /[\%\s\|\$\*\.\']/)&&(&PError("Error. Invalid character in username")); ($in{'mpassword'} =~ /[\%\s\|\$\*\.\']/)&&(&PError("Error. Invalid character in password")); open(DB,"<$basepath/setup.cgi"); while(){ $buff .= $_; } close DB; if($^O !~ /win/i){ $encpass = crypt($in{'mpassword'},'CS'); } else{ $encpass = $in{'mpassword'}; } $buff =~ s/\$username='.*'/\$username='$in{'musername'}'/; $buff =~ s/\$password='.*'/\$password='$encpass'/; open(DB,">$basepath/setup.cgi"); print DB $buff; close DB; print <<"EOF"; EOF exit; } sub ShowCP{ if(!$admin){ &PError("Permission denied"); } $in{'musername'} = $in{'username'}; &PageOut("$cgipath/t_cp.htm"); exit; } sub GetNlinks{ my($count,$numberPer,$tid) = @_; my ($page,$lpage,$link,$nstart,$nend,$pend); $page='';$lpage='';$link=''; $page = $in{'page'}; $lpage = $in{'lpage'}; (!$page)&&($page = $in{'page'}); (!$lpage)&&($lpage = $in{'lpage'}); if($in{'dc'}){ my $dc = $in{'dc'}; $page = $dc =~ /page\s*=\s*(\d*)/; $lpage = $dc =~ /lpage\s*=\s*(\d*)/; } (!$page)&&($page=1); ((!$page)||($lpage < 0))&&($lpage = 1); $nstart = ($lpage+10)-10; $nend = $nstart + 10; $npages = int($count/$numberPer); (($count/$numberPer) > $npages)&&($npages++); for(my $i = 1; $i <= $npages; $i++){ if(($i >= $nstart) && ($i < $nend)){ if($i != $page){ $link .= " $i "; } else{ $link .= " [$i] "; } } } $pend = $nend - 20; ($npages > $nend)&&($link .= " [Next] "); ($nend > 11)&&($link = " [Prev] " . $link); (!$link)&&($link='0'); return ($link); } sub GetNlinksMan{ my($count,$numberPer,$gid,$tid) = @_; my ($page,$lpage,$link,$nstart,$nend,$pend); $page='';$lpage='';$link=''; $page = $in{'page'}; $lpage = $in{'lpage'}; (!$page)&&($page=1); ((!$page)||($lpage < 0))&&($lpage = 1); $nstart = ($lpage+10)-10; $nend = $nstart + 10; $npages = int($count/$numberPer); (($count/$numberPer) > $npages)&&($npages++); for(my $i = 1; $i <= $npages; $i++){ if(($i >= $nstart) && ($i < $nend)){ ($i == $page)?($link .= " $i "):($link .= " $i "); } } $pend = $nend - 20; ($npages > $nend)&&($link .= " [Next] "); ($nend > 11)&&($link = " [Prev] " . $link); (!$link)&&($link='0'); return ($link); } sub htmlspecialchars{ my($buffer) =@_; $buffer =~ s/\&/\&/g; $buffer =~ s/\/\>/g; $buffer =~ s/\"/\"/g; return $buffer; } sub GetID{ my($id); open(DB,"<$datapath/_gcount.cgi"); ($flock)&&(flock(DB,2)); $id = ; ($flock)&&(flock(DB,8)); close DB; $id++; open(DB,">$datapath/_gcount.cgi"); ($flock)&&(flock(DB,2)); print DB $id; ($flock)&&(flock(DB,8)); close DB; return $id; } sub DoAddForm{ $in{'addform'} = qq|
 
|; } sub GetTopicName{ my $subject=''; open(DB,"<$datapath/$in{'gid'}.cgi"); while(){ chomp; my($mtid) = (split("\t",$_))[0]; if($mtid==$in{'tid'}){ $subject = (split("\t",$_))[19]; } } close DB; return $subject; }


image
image