V2/Legacy.pm untested

filter: Statementstmt 0.0% 0 / 225 Branchbran 0.0% 0 / 74 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 67 Podpod 0.0% 0 / 64 totaltotal 0.0% 0 / 435 CC 38 SCAR 16.1
CC
38
Cov
0%
sendMailBin
12.0
adminLoginId
6.0
adminPageId
6.0
CRAP 5.0
1 package FWS::V2::Legacy;
2  
3 use 5.006;
4 use strict;
5 use warnings;
6  
7 =head1 NAME
8  
9 FWS::V2::Legacy - Framework Sites version 2 compatibility and legacy methods and translations
10  
11 =head1 VERSION
12  
13 Version 1.13091122
14  
15 =cut
16  
17 our $VERSION = '1.13091122';
18  
19  
20 =head1 SYNOPSIS
21  
22 use FWS::V2;
23  
24 my $fws = FWS::V2->new();
25  
26 $fws->domain('http://www.mynewdomain.com');
27 $fws->secureDomain('https://www.mynewdomain.com');
28 ...
29  
30  
31 =head1 DESCRIPTION
32  
33 FWS version 2 legacy methods are here for compatibility from upgrade paths of 1.3 and will not be present in the next version of FWS. Most of the methods are deprecated for the most part because they are get/set subroutines that allow you to change something that you should not change after new() is called. In a worst case scenario if you REALLY needed to change a setting you could access it via $fws->{thesetting} = 'something' instead.
34  
35 =head1 METHODS
36  
37 =head2 addExtraHash
38  
39 This was renamed to mergeExtra().
40  
41 =cut
42  
43 sub addExtraHash {
44 my ( $self, $extraValue, %addHash ) = @_;
45 return $self->mergeExtra( $extraValue, %addHash );
46 }
47  
48  
49 =head2 adminLoginId
50  
51 Should NEVER be set manually, it will be set during processLogin(). Will return the current admin user logged in. If it is blank then no admin user is logged in and can be accessed via $fws->{adminLoginId};
52  
53 =cut
54  
55 sub adminLoginId {
56 my ( $self, $adminLoginId ) = @_;
57 if ( $adminLoginId ) { $self->{adminLoginId} = $adminLoginId }
58 return $self->{adminLoginId};
59 }
60  
61 =head2 adminPageId
62  
63 The default value is set to 'admin', which would be accessed via yourdomain.com/admin. Should be set when calling new(adminURL=>'admin') and can be accessed via $fws->{adminURL};
64  
65 =cut
66  
67 sub adminPageId {
68 my ( $self, $adminPageId ) = @_;
69 if ( $adminPageId ) { $self->{adminURL} = $adminPageId }
70 return $self->{adminURL};
71 }
72  
73 =head2 adminPassword
74  
75 Should be set when calling new(). This is only used for internal security for the first time log in, and is disabled once an admin account is created.
76  
77 =cut
78  
79 sub adminPassword {
80 my ( $self, $adminPassword ) = @_;
81 if ( $adminPassword ) { $self->{adminPassword} = $adminPassword }
82 return $self->{adminPassword};
83 }
84  
85  
86 =head2 affiliateId
87  
88 Is set by passing 'a' as a form value. Can be accessed via $fws->{affiliateId};
89  
90 =cut
91  
92 sub affiliateId {
93 my ( $self, $affiliateId ) = @_;
94 if ( $affiliateId ) { $self->{affiliateId} = $affiliateId }
95 return $self->{affiliateId};
96 }
97  
98 =head2 ajaxEnable
99  
100 Deprecated here for backwards compatibility in code.
101  
102 =cut
103  
104 sub ajaxEnable {
105 my ( $self ) = @_;
106 return '';
107 }
108  
109 =head2 cookieDomainName
110  
111 Should be set when calling new() and can be accessed via $fws->{cookieDomainName};
112  
113 =cut
114  
115 sub cookieDomainName {
116 my ( $self, $cookieDomainName ) = @_;
117 if ( $cookieDomainName ) { $self->{cookieDomainName} = $cookieDomainName }
118 return $self->{cookieDomainName};
119 }
120  
121 =head2 email
122  
123 Is set when calling setSiteValues() and can be accessed via $fws->{email};
124  
125 =cut
126  
127 sub email {
128 my ( $self, $email ) = @_;
129 if ( $email ) { $self->{email} = $email }
130 return $self->{email};
131 }
132  
133  
134 =head2 dataCacheFields
135  
136 Deprecated. Internal only but was exported at one point so it is here for compatability
137  
138 =cut
139  
140 sub dataCacheFields {
141 my ( $self, %dataCacheFields ) = @_;
142 if (keys %dataCacheFields) { %{$self->{dataCacheFields}} = %dataCacheFields }
143 return %{$self->{dataCacheFields}};
144 }
145  
146 =head2 debug
147  
148 Deprecated. All logging is handled via $fws->FWSLog.
149  
150 =cut
151  
152 sub debug {
153 my ( $self ) = @_;
154 return '';
155 }
156  
157 =head2 domain
158  
159 Should be set when calling new() and can be accessed via $fws->{domain};
160  
161 =cut
162  
163 sub domain {
164 my ( $self, $domain ) = @_;
165 if ( $domain ) { $self->{domain} = $domain }
166 return $self->{domain};
167 }
168  
169 =head2 encryptionKey
170  
171 Should be set when calling new() and can be accessed via $fws->{encryptionKey};
172  
173 =cut
174  
175 sub encryptionKey {
176 my ( $self, $encryptionKey ) = @_;
177 if ( $encryptionKey ) { $self->{encryptionKey} = $encryptionKey }
178 return $self->{encryptionKey};
179 }
180  
181 =head2 encryptionType
182  
183 Should be set when calling new() and can be accessed via $fws->{encryptionType};
184  
185 =cut
186  
187 sub encryptionType {
188 my ( $self, $encryptionType ) = @_;
189 if ( $encryptionType ) { $self->{encryptionType} = $encryptionType }
190 return $self->{encryptionType};
191 }
192  
193 =head2 fileDir
194  
195 Should be set when calling new() and can be accessed via $fws->{fileDir};
196  
197 =cut
198  
199 sub fileDir {
200 my ( $self, $fileDir ) = @_;
201 if ( $fileDir ) { $self->{fileDir} = $fileDir }
202 return $self->{fileDir};
203 }
204  
205  
206 =head2 filePackagePath
207  
208 Deprecated. This is set during siteSiteValues().Should be set when calling new() and can be accessed via $fws->{fileFWSPath};
209  
210 =cut
211  
212 sub filePackagePath {
213 my ( $self, $filePackagePath ) = @_;
214 if ( $filePackagePath ) { $self->{fileFWSPath} = $filePackagePath }
215 return $self->{fileFWSPath};
216 }
217  
218 =head2 filePath
219  
220 Should be set when calling new() and can be accessed via $fws->{filePath};
221  
222 =cut
223  
224 sub filePath {
225 my ( $self, $filePath ) = @_;
226 if ( $filePath ) { $self->{filePath} = $filePath }
227 return $self->{filePath};
228 }
229  
230 =head2 fileSecurePath
231  
232 Should be set when calling new() and can be accessed via $fws->{fileSecurePath};
233  
234 =cut
235  
236 sub fileSecurePath {
237 my ( $self, $fileSecurePath ) = @_;
238 if ( $fileSecurePath ) { $self->{fileSecurePath} = $fileSecurePath }
239 return $self->{fileSecurePath};
240 }
241  
242 =head2 fileStagingPath
243  
244 Deprecated, V2 does not have built in staging control. Staging is handled by an external methodology.
245  
246 =cut
247  
248 sub fileStagingPath {
249 my ( $self ) = @_;
250 return $self->{filePath};
251 }
252  
253 =head2 fileWebPath
254  
255 Should be set when calling new() and can be accessed via $fws->{fileWebPath};
256  
257 =cut
258  
259 sub fileWebPath {
260 my ( $self, $fileWebPath ) = @_;
261 if ( $fileWebPath ) { $self->{fileWebPath} = $fileWebPath }
262 return $self->{fileWebPath};
263 }
264  
265 =head2 fileWebStagingPath
266  
267 Deprecated, V2 does not have built in staging control. Staging is handled by an external methodology.
268  
269 =cut
270  
271 sub fileWebStagingPath {
272 my ( $self ) = @_;
273 return $self->{fileWebPath};
274 }
275  
276 =head2 gatewayType
277  
278 Is set with the administration and normally not accessed outside of the core. Can be accessed via $fws->{gatewayType};
279  
280 =cut
281  
282 sub gatewayType {
283 my ( $self, $gatewayType ) = @_;
284 if ( $gatewayType ) { $self->{gatewayType} = $gatewayType }
285 return $self->{gatewayType};
286 }
287  
288 =head2 gatewayUserID
289  
290 Is set with the administration and normally not accessed outside of the core. Can be accessed via $fws->{gatewayUserId};
291  
292 =cut
293  
294 sub gatewayUserID {
295 my ( $self, $gatewayUserID ) = @_;
296 if ( $gatewayUserID ) { $self->{gatewayUserID} = $gatewayUserID }
297 return $self->{gatewayUserID};
298 }
299  
300 =head2 googleAppsKeyFile
301  
302 Should be set when calling new() and can be accessed via $fws->{googleAppsKeyFile};
303  
304 =cut
305  
306 sub googleAppsKeyFile {
307 my ( $self, $googleAppsKeyFile ) = @_;
308 if ( $googleAppsKeyFile ) { $self->{googleAppsKeyFile} = $googleAppsKeyFile }
309 return $self->{googleAppsKeyFile};
310 }
311  
312  
313 =head2 getPageGUID
314  
315 This is depricated. To get this value you can retrieve it from the dataHash or dataArray under the pageGUID key.
316  
317 =cut
318  
319 sub getPageGUID {
320 my ( $self, $guid, $depth ) = @_;
321  
322 my ( $pageGUID ) = @{$self->runSQL( SQL => "select page_guid from data where guid='" . $self->safeSQL( $guid ) . "'" )};
323  
324 $pageGUID ||= $self->_setPageGUID( guid => $guid, depth => $depth );
325  
326 return $pageGUID;
327 }
328  
329  
330 =head2 navigationHref
331  
332 Deprecated, use navigationLink() and add hrefOnly flag.
333  
334 =cut
335  
336 sub navigationHref {
337 my ( $self, %hrefHash ) = @_;
338 $hrefHash{hrefOnly} = 1;
339 return $self->navigationLink(%hrefHash);
340 }
341  
342  
343 =head2 newDBCheck
344  
345 Renamed to createFWSDatabase().
346  
347 =cut
348  
349 sub newDBCheck {
350 my ( $self ) = @_;
351 $self->createFWSDatabase();
352 }
353  
354  
355 =head2 phone
356  
357 Deprecated, use formatPhone()
358  
359 =cut
360  
361 sub phone {
362 my ( $self, %paramHash ) = @_;
363 return $self->formatPhone(%paramHash);
364 }
365  
366  
367 =head2 processDownloads
368  
369 Deprecated, all downloads are handled by the rendering element.
370  
371 =cut
372  
373 sub processDownloads {
374 return 1;
375 }
376  
377  
378 =head2 siteGlobalValue
379  
380 Deprecated, use siteValue()
381  
382 =cut
383  
384 sub siteGlobalValue {
385 my ( $self, $key, $value ) = @_;
386 return $self->siteValue( $key, $value );
387 }
388  
389  
390 =head2 skipIpCheckOnLogin
391  
392 Deprecated, session management was updated to improve ip checking to make this no longer required.
393  
394 =cut
395  
396 sub skipIpCheckOnLogin {
397 my ( $self ) = @_;
398 return 0;
399 }
400  
401  
402 =head2 dateTime
403  
404 Deprecated, use formatDate()
405  
406 =cut
407  
408 sub dateTime {
409 my ( $self, %paramHash ) = @_;
410 return $self->formatDate( %paramHash );
411 }
412  
413  
414 =head2 showDateTime
415  
416 Deprecated, use formatDate()
417  
418 =cut
419  
420 sub showDateTime {
421 my $self;
422 my %paramHash;
423 ( $self, $paramHash{format}, $paramHash{monthMod}, $paramHash{epochTime}, $paramHash{GMTOffset}, $paramHash{SQLTime} ) = @_;
424 return $self->formatDate(%paramHash);
425 }
426  
427 =head2 tinyMCEHead
428  
429 Deprecated, built into the fws-2.x.css
430  
431 =cut
432  
433 sub tinyMCEHead {
434 my ( $self ) = @_;
435 return '';
436 }
437  
438  
439 =head2 truncatePhrase
440  
441 Deprecated, use truncateContent()
442  
443 =cut
444  
445 sub truncatePhrase {
446 my ( $self, $theString, $maxLength ) = @_;
447 return $self->truncateContent( content => $theString, length => $maxLength );
448 }
449  
450 =head2 pageIdOfElement
451  
452 Method name changed, use $fws->getPageGUID('theguid')
453  
454 =cut
455  
456 sub pageIdOfElement {
457 my ( $self, $guid ) = @_;
458 return $self->getPageGUID( $guid );
459 }
460  
461  
462 =head2 getFormValues {
463  
464 Renamed to setFormValues()
465  
466 =cut
467  
468 sub getFormValues {
469 my ( $self ) = @_;
470 return $self->setFormValues();
471 }
472  
473  
474 =head2 getPluginVersion
475  
476 Single extraction of version replaced by pluginInfo()
477  
478 =cut
479  
480 sub getPluginVersion {
481 my ( $self, $pluginFile ) = @_;
482 my %pluginInfo = $self->pluginInfo( $pluginFile );
483 return $pluginInfo{version};
484 }
485  
486  
487 =head2 guidKey
488  
489 Deprecated, no longer needed with V2 security models
490  
491 =cut
492  
493 sub guidKey {
494 my ( $self ) = @_;
495 return;
496 }
497  
498  
499 =head2 initActions
500  
501 Deprecated, no longer needed with V2 work flow models
502  
503 =cut
504  
505 sub initActions {
506 my ( $self ) = @_;
507 return;
508 }
509  
510  
511 =head2 isStaging
512  
513 Deprecated.
514  
515 =cut
516  
517 sub isStaging { return 1 }
518  
519  
520 =head2 openRS
521  
522 Depricated, use runSQL instead.
523  
524 =cut
525  
526 sub openRS {
527 my ( $self, $SQL ) = @_;
528 return @{$self->runSQL( SQL => $SQL )};
529 }
530  
531  
532 =head2 postHTTP
533  
534 Depricated, use HTTPRequest instead.
535  
536 =cut
537  
538 sub postHTTP {
539 my ( $self, %paramHash ) = @_;
540 my $res = $self->HTTPRequest( %paramHash );
541 if ( $res->{success} ) { return ( $res->{content}, 1 ) }
542 else { return ( $res->{status}, 0 ) }
543 }
544  
545  
546 =head2 resizeImage
547  
548 Depricated, use saveImage instead.
549  
550 =cut
551  
552 sub resizeImage {
553 my ( $self, $origFile, $newFile, $newWidth, $newHeight ) = @_;
554 return $self->saveImage( sourceFile => $origFile, fileName => $newFile, width => $newWidth, height => $newHeight );
555 }
556  
557  
558 =head2 runSiteActions
559  
560 Depricated, all site actions are in plugins or elements
561  
562 =cut
563  
564 sub runSiteActions {
565 return '';
566 }
567  
568  
569 =head2 scriptName
570  
571 Should be set when calling new() and can be accessed via $fws->{scriptName};
572  
573 =cut
574  
575 sub scriptName {
576 my ( $self, $scriptName ) = @_;
577 if ( $scriptName ) { $self->{scriptName} = $scriptName }
578 return $self->{scriptName};
579 }
580  
581 =head2 secureDomain
582  
583 Should be set when calling new() and can be accessed via $fws->{secureDomain};
584  
585 =cut
586  
587 sub secureDomain {
588 my ( $self, $secureDomain ) = @_;
589 if ( $secureDomain ) { $self->{secureDomain} = $secureDomain }
590 return $self->{secureDomain};
591 }
592  
593 =head2 securePageHash
594  
595 Depricated. All secure page references are done manually for performance and unique logic restrictions.
596  
597 =cut
598  
599 sub securePageHash {
600 my ( $self ) = @_;
601 return ();
602 }
603  
604  
605 =head2 sendMailBin
606  
607 Should be set when calling new() and can be accessed via $fws->{sendmailBin};
608  
609 =cut
610  
611 sub sendMailBin {
612 my ( $self, $sendmailBin ) = @_;
613 if ( $sendmailBin ) { $self->{sendmailBin} = $sendmailBin }
614 if ( !$self->{sendmailBin} ) { return "/usr/sbin/sendmail" }
615 return $self->{sendmailBin};
616 }
617  
618 =head2 sendMethod
619  
620 Should be set when calling new() and can be accessed via $fws->{sendMethod};
621  
622 =cut
623  
624 sub sendMethod {
625 my ( $self, $sendMethod ) = @_;
626 if ( $sendMethod ) { $self->{sendMethod} = $sendMethod }
627 return $self->{sendMethod};
628 }
629  
630 =head2 siteGUID
631  
632 Used to retreive the current site GUID. Can be accessed via $fws->{siteGUID};
633  
634 =cut
635  
636 sub siteGUID {
637 my ( $self, $siteGUID ) = @_;
638 if ( $siteGUID ) { $self->{siteGUID} = $siteGUID }
639 return $self->{siteGUID};
640 }
641  
642 =head2 siteId
643  
644 Used to retreive the current site Id. Can be accessed via $fws->{siteId};
645  
646 =cut
647  
648 sub siteId {
649 my ( $self, $siteId ) = @_;
650 if ( $siteId ) { $self->{siteId} = $siteId }
651 return $self->{siteId};
652 }
653  
654 =head2 siteName
655  
656 Used to retreive the current site GUID. Can be accessed via $fws->{siteName};
657  
658 =cut
659  
660 sub siteName {
661 my ( $self, $siteName ) = @_;
662 if ( $siteName ) { $self->{siteName} = $siteName }
663 return $self->{siteName};
664 }
665  
666 =head2 tinyMCEEnable
667  
668 Should be set when calling new() and can be accessed via $fws->{tinyMCEEnable};
669  
670 =cut
671  
672 sub tinyMCEEnable {
673 my ( $self, $tinyMCEEnable ) = @_;
674 if ( $tinyMCEEnable ) { $self->{tinyMCEEnable} = $tinyMCEEnable }
675 return $self->{tinyMCEEnable};
676 }
677  
678  
679 =head2 queryHead
680  
681 Should be set when calling new() and can be accessed via $fws->{queryHead};
682  
683 =cut
684  
685 sub queryHead {
686 my ( $self, $queryHead ) = @_;
687 if ( $queryHead ) { $self->{queryHead} = $queryHead }
688 return $self->{queryHead};
689 }
690  
691 =head2 userLoginId
692  
693 Should NEVER be set manually, it will be set during processLogin(). Will return the current site user logged in. If it is blank then no site user is logged in and can be accessed via $fws->{userLoginId};
694  
695 =cut
696  
697 sub userLoginId {
698 my ( $self, $userLoginId ) = @_;
699 if ( $userLoginId ) { $self->{userLoginId} = $userLoginId }
700 return $self->{userLoginId};
701 }
702  
703  
704 =head2 DBHost
705  
706 Should be set when calling new() and can be accessed via $fws->{DBHost};
707  
708 =cut
709  
710 sub DBHost {
711 my ( $self, $DBHost ) = @_;
712 if ( $DBHost ) { $self->{DBHost} = $DBHost }
713 return $self->{DBHost};
714 }
715  
716 =head2 DBName
717  
718 Should be set when calling new() and can be accessed via $fws->{DBName};
719  
720 =cut
721  
722 sub DBName {
723 my ( $self, $DBName ) = @_;
724 if ( $DBName ) { $self->{DBName} = $DBName }
725 return $self->{DBName};
726 }
727  
728 =head2 DBPassword
729  
730 Should be set when calling new() and can be accessed via $fws->{DBPassword};
731  
732 =cut
733  
734 sub DBPassword {
735 my ( $self, $DBPassword ) = @_;
736 if ( $DBPassword ) { $self->{DBPassword} = $DBPassword }
737 return $self->{DBPassword};
738 }
739  
740 =head2 DBType
741  
742 Should be set when calling new() and can be accessed via $fws->{DBType};
743  
744 =cut
745  
746 sub DBType {
747 my ( $self, $DBType ) = @_;
748 if ( $DBType ) { $self->{DBType} = $DBType }
749 return $self->{DBType};
750 }
751  
752 =head2 DBUser
753  
754 Should be set when calling new() and can be accessed via $fws->{DBUser};
755  
756 =cut
757  
758 sub DBUser {
759 my ( $self, $DBUser ) = @_;
760 if ( $DBUser ) { $self->{DBUser} = $DBUser }
761 return $self->{DBUser};
762 }
763  
764 =head2 FWSLogLevel
765  
766 Should be set when calling new() and can be accessed via $fws->{FWSLogLevel};
767  
768 =cut
769  
770 sub FWSLogLevel {
771 my ( $self, $FWSLogLevel ) = @_;
772 if ( $FWSLogLevel ) { $self->{FWSLogLevel} = $FWSLogLevel }
773 return $self->{FWSLogLevel};
774 }
775  
776 =head2 SQLLogLevel
777  
778 Should be set when calling new() and can be accessed via $fws->{SQLLogLevel};
779  
780 =cut
781  
782 sub SQLLogLevel {
783 my ( $self, $SQLLogLevel ) = @_;
784 if ( $SQLLogLevel ) { $self->{SQLLogLevel} = $SQLLogLevel }
785 return $self->{SQLLogLevel};
786 }
787  
788  
789 =head2 XMLNode
790  
791 Node safe routine for XML replaced by safeXML
792  
793 =cut
794  
795 sub XMLNode {
796 my ( $self, $XMLNode ) = @_;
797 $XMLNode =~ s/&/&/sxg;
798 $XMLNode =~ s/\</&lt;/sxg;
799 return $XMLNode;
800 }
801  
802  
803 =head2 CSVNode
804  
805 Node safe routine for XML replaced by safeCSV
806  
807 =cut
808  
809 sub CSVNode {
810 my ( $self, $CSVNode ) = @_;
811 $CSVNode =~ s/(,|;)/ /sxg;
812 $CSVNode =~ s/(\n|\r)//sxg;
813 $CSVNode =~ s/^('|")//sxg;
814 return $CSVNode;
815 }
816  
817  
818 =head1 AUTHOR
819  
820 Nate Lewis, C<< <nlewis at gnetworks.com> >>
821  
822 =head1 BUGS
823  
824 Please report any bugs or feature requests to C<bug-fws-v2 at rt.cpan.org>, or through
825 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FWS-V2>. I will be notified, and then you'll
826 automatically be notified of progress on your bug as I make changes.
827  
828  
829  
830  
831 =head1 SUPPORT
832  
833 You can find documentation for this module with the perldoc command.
834  
835 perldoc FWS::V2::Legacy
836  
837  
838 You can also look for information at:
839  
840 =over 4
841  
842 =item * RT: CPAN's request tracker (report bugs here)
843  
844 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=FWS-V2>
845  
846 =item * AnnoCPAN: Annotated CPAN documentation
847  
848 L<http://annocpan.org/dist/FWS-V2>
849  
850 =item * CPAN Ratings
851  
852 L<http://cpanratings.perl.org/d/FWS-V2>
853  
854 =item * Search CPAN
855  
856 L<http://search.cpan.org/dist/FWS-V2/>
857  
858 =back
859  
860  
861 =head1 LICENSE AND COPYRIGHT
862  
863 Copyright 2013 Nate Lewis.
864  
865 This program is free software; you can redistribute it and/or modify it
866 under the terms of either: the GNU General Public License as published
867 by the Free Software Foundation; or the Artistic License.
868  
869 See http://dev.perl.org/licenses/ for more information.
870  
871  
872 =cut
873  
874 1; # End of FWS::V2::Legacy