Current File : /home/mmdealscpanel/yummmdeals.com/cgi.tar
escape.so000075500000037060150327436420006366 0ustar00ELF>@@07@8	@�$�$ �,�, �, X� �,�, �, ��888$$`$`$`$  S�td`$`$`$  P�tdP"P"P"LLQ�tdR�td�,�, �, XXGNU���\\��P7koedQ9�&�R 0&()BE���|�qXL��U	-	��A �_e�G�����U~ �x1�i��/�, SF"^p<��0 �(0 �0 ���R�)__gmon_start___ITM_deregisterTMCloneTable_ITM_registerTMCloneTable__cxa_finalizerb_string_valuerb_enc_getrb_call_superrb_enc_dummy_prb_to_encodingrb_enc_to_indexrb_str_catruby_digit36_to_number_tablerb_str_buf_newrb_enc_associaterb_enc_get_indexrb_enc_associate_indexrb_enc_str_coderangerb_str_duprb_cSymbolrb_cvar_getrb_cIntegerrb_cFloatrb_cFalseClassrb_cTrueClassrb_cNilClassrb_error_arity__stack_chk_failstrcasecmpruby_scan_digitsruby_hexdigitsInitVM_escaperb_cObjectrb_define_classrb_define_module_underrb_define_methodrb_prepend_modulerb_extend_objectInit_escaperb_intern2libruby.so.2.5libc.so.6_edata__bss_start_endGLIBC_2.4GLIBC_2.2.5xii
�ui	��, ��, ��, �, �/ �/ �/ �/ �/ �/ 
�/ �/ �/ �/ �/  �/ !�/ $�. �. �. )�. �. �. 	�. 
/ / / /  / (/ 0/ 8/ @/ H/ P/ X/ `/ h/ p/ x/ !�/ "�/ #�/ %��H��H��! H��t��H����5�  �%�  ��h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h	��Q������h
��A������h��1������h��!������h
��������h��������h������h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h��Q�������% D���% D���%
 D���% D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%� D���%} D���%u D���%m D���%e D���%] D���%U DH�=� H�� H9�tH�F H��t	�����H�=� H�5� H)�H��H��H��?H�H�tH�E H��t��fD�����=E u+UH�=* H��tH�=� �)����d���� ]������w������AWAVAUATUS��H��HdH�%(H�D$81��G����LH�H�|$(H��I��H�D$(���H�|$(�~����xt8H������I��H�L$8dH3%(L���H��H[]A\A]A^A_�DH������D$��u����/H�}H�\$(H�\$�$���H������H�+�D$�� ��H��L�c��H����H�D$7E1�E1�1�H�D$�N�<+���D$7 I��M����L)�K�44L��H��I�]����H�t$L��I�޺���H9���A�<%u�L�kI9�}~A�T�Ѓ�0��	v
�ƒ�߃�A��wTA�|����0��	v�׃�߃�A@��w6H�=� �������
�D$7M���[���H�����I���K���f�H��H9��p���M����H��K�44L��L)��8���H�\$H������L��H������H�H�D$%I	H�|$����ËD$9��-�����L���n���L��������1��	�����L���J����L$����I�Lc�H%���I	�M�7�����H�\$H�����I��H�H�D$�D$%0�D$�f���fDH�D$H�hL�`����fDH�5) A��t+A��uUD�����tVI��thA��u"H�� H�8�f�I�����uI��tQM��t4I�|$����H���w���f.�H�� H�8��H�] H�8��H�y H�8��H�e H�8�H�I H�8뭺����������AWAVAUATUSH��xH�t$HH�\$HH��dH�%(H�D$h1��|���H�|$H�����xt<H�޿�?���I��H�L$hdH3%(L���bH��x[]A\A]A^A_�fDH���8�����u�L�l$HA���L�����H�5�	H�XH�D$0H���Y�����t H�5�	H���F�����M�A��I��I�m�� �%H��M�}��H���H�L$SH�t$XE1�E1�H�L$H�L$b1�H�L$8H�L$TH�L$H�t$ L�l$L�t$(I��L�ՐA�H�X�T$S��&unI��I)�L9�}oA��T$S��g�����#�:��au=H�PL��H)�L�H�����:pos;��f�:mp���H�X@H��L9��t���L�l$I��M���#L��K�4L��L)����L���I���L��H���~���I�E%I	$�@���@��l����qu�H�PL��H)�H��~�A�|uot;�s����D$S"H�XM����I�4/L��L���:���H�t$�L���(���H�CH���?���@H�PL��H)�H������fA�|t;H�X�����D$S>�H�XL��I�<H)��H��~�ʃ�0��	�����H�X��X����L��H)�H���QI�<��ʃ�0��	�-H�L$ L�D$����H��H�D$X�T$TH�H�X���~���H;L$(�s���A�<;�h���M���RI�4/L��L��H�L$@�+���H�L$@H�|$(�H�l$8H�D$0��H��H��P0H��L��Hc���H������@H�PL��H)�H�����fA�|t;H�X����D$S<�f����L������I���W���L�����I���D���I�mM�}����H���|�������H�X�D$S'����f���߃�A������H�X�h����H�L$ L�D$�
���H�����@�z;�.���H�X�D$S&���H�t$�L��L$S�����L��H�L$@����H�L$@I��������ff.���AWAVAUATUSH��(H�\$H�t$H�����H�|$�2����xt,H�޿�o���I��H��(L��[]A\A]A^A_�f.�H���x�����u�H�l$H�]�� ��H��L�e��H����1�E1�L�5�1�A�L�j��>wr�H��H��PH��t[M���"H)�L��L����C�D,���"<�S��Ic�L�>��fDH�5��L����L��f�L��I9��t���M����H)�L��L��}�H����L��H���J�H�E%I	����f�H�5i�L���<�L����H�56�L����L���t���@H�5�L����L���T���@H�5�L�����L���4���@H��H�t$H�T$���H�t$H�T$I�����@H�����I�������H�]L�e�L���L���������AWAVAUATUSH��HH�t$(H�\$(H��dH�%(H�D$81��L�H�|$(���xt<H�޿��I��H�L$8dH3%(L����H��H[]A\A]A^A_�fDH�����u�H�D$(�D$4�D$4%H�H�D$ �� �aH��L�`��H���5H�D$41�E1�1�H�D$H�-mDE�,L�rA�E�<Qw��HcD�H�>��M����H)�L��L��Y�A�� ��D��H�� M��L����A��H�t$���D�D$5A�D��D$6��L��L��I9��t���M����H)�L��L����H�\$ H����L��H����H�%I	���DH�5��L����L����H��H�t$H�T$��H�t$H�T$I������@H�|$ ��I���J���fDH�D$ H�XL�`����9�f���H��H�� H�=VH�0�"�H�5KH��H� ���H�=� H�55H�� ��H�=� �H����H�5H�� ��H�=� �H����H�5����H�=� �H�*���H�5����H�=g �����H�K�H�5���H�5H H�=I ��H�55 H�=> H�����D��H���H�=~��H�� H������H��H���UTF-8ISO-8859-1&#39;&amp;&quot;&lt;&gt;+CGIEscapeUtilunescapeHTMLunescape@@accept_charset�����������������l���������������������������������������������������������������L�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������;L��hP�����@�� ���@p��������������zRx�$0��FJw�?:*3$"D���H\��F�B�B �B(�A0�A8�F�l
8A0A(B BBBFH�D��F�B�B �B(�A0�A8�D�]
8A0A(B BBBGH����HF�B�B �B(�A0�A8�D`v
8D0A(B BBBKH@���'F�B�B �B(�A0�A8�D�]
8A0A(B BBBG������H������)H\GNU����, ix�

 �, �, ���o`��
��. pX�	�	���o���o�	���o�oP	���o�,  0@P`p�������� 0@P`p��GA$3a1�
) GA$3p1113 GA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*GOW*�GA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realign
GA*FORTIFY�GA+GLIBCXX_ASSERTIONSescape.so-2.5.9-114.module_el8.10.0+3991+5e651d4e.x86_64.debug��Y�7zXZ�ִF!t/��9]?�E�h=��ڊ�2N�-lPj[�3��	�k�	�����qs���]�܀?)�bp��삁5zDn8m(Ty��՞���8�z��8U�1}>d1z�f�wz}�o�N�w�zX�-#(L9$���+1)Bu�k�¨*����I�6�$Zy���eՇ.��,�ȁ%7FW~M�gs:2ΚD����ٕ�
b
x��6��6'�Vg$�&4��fEZ�*�r����w��I�/*��c�B4���}��/E���Wmy���a��fX�b��F�)�s��&Pֶ[i��>9A/U��je*�(�W��V$;C�		5�s��
N�`cԨ���t("�Ū\�~]
݃}5
~/ު�
Ww�	?|l����i3�Pv]ڎl��v	�FU�,�'>�a��u�w�Z����܃{��/�Fur���6{�ӂ���|�<C�x��SK�q��Tr�Jd����B�|�;�������D�}��:9F�)�c�/ݡz �|"���;X����/X�m��d�i������-�(��Ə'�ĢcJ�m�lE�m6�ȓ��nR�#��
�*�[�e�M9d�F_F��J���dm�����Àz�K_�3�{+��yi��2��ݩ��̠�˵F#�S(U����O
"\�Ef�p^˜��*����������գ��&me�yP|��f'ʓ�A��R�w�<�LI�c9P8A��ʌi/���S���HU.G�t���ỷ6~���������]其�8���v����
�(���k�_��8?�
��5�E�Eq�����'��1
x���*A���g�YZ.shstrtab.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.note.gnu.property.init_array.fini_array.data.rel.ro.dynamic.got.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata88$���o``8(��0���8���oP	P	VE���o�	�	0T�	�	�^BXXph�
�
c�
�
�n���w@@�}  
�, , $�P"P"L��"�"��`$`$ ��, �,��, �,��, �,��, �,���. �.P�0 0(�(0`0HH2D�2|6"cgi2.pyc000064400000001331150400404610006075 0ustar00�
Afc@sKdZddlZej�ddlZd�ZedkrGe�ndS(s%CGI test 2 - basic use of cgi module.i����NcCsptj�}dGHH|s dGHnLdGHxD|j�D]6}||j}dGtj|�GdGtj|�GHq2WdS(NsContent-type: text/htmls<h1>No Form Keys</h1>s<h1>Form Keys</h1>s<p>t:(tcgitFieldStoragetkeystvaluetescape(tformtkeyR((s%/usr/lib64/python2.7/Demo/cgi/cgi2.pytmain	s
t__main__(t__doc__tcgitbtenableRRt__name__(((s%/usr/lib64/python2.7/Demo/cgi/cgi2.pyt<module>s
	cgi2.pyo000064400000001331150400404610006111 0ustar00�
Afc@sKdZddlZej�ddlZd�ZedkrGe�ndS(s%CGI test 2 - basic use of cgi module.i����NcCsptj�}dGHH|s dGHnLdGHxD|j�D]6}||j}dGtj|�GdGtj|�GHq2WdS(NsContent-type: text/htmls<h1>No Form Keys</h1>s<h1>Form Keys</h1>s<p>t:(tcgitFieldStoragetkeystvaluetescape(tformtkeyR((s%/usr/lib64/python2.7/Demo/cgi/cgi2.pytmain	s
t__main__(t__doc__tcgitbtenableRRt__name__(((s%/usr/lib64/python2.7/Demo/cgi/cgi2.pyt<module>s
	README000064400000000665150400404610005425 0ustar00CGI Examples
------------

Here are some example CGI programs.  For a larger example, see
../../Tools/faqwiz/.

cgi0.sh -- A shell script to test your server is configured for CGI
cgi1.py -- A Python script to test your server is configured for CGI
cgi2.py -- A Python script showing how to parse a form
cgi3.py -- A Python script for driving an arbitrary CGI application
wiki.py -- Sample CGI application: a minimal Wiki implementation
cgi3.py000075500000000227150400404610005741 0ustar00#! /usr/bin/python2.7

"""CGI test 3 (persistent data)."""

import cgitb; cgitb.enable()

from wiki import main

if __name__ == "__main__":
    main()
cgi2.py000075500000000726150400404610005744 0ustar00#! /usr/bin/python2.7

"""CGI test 2 - basic use of cgi module."""

import cgitb; cgitb.enable()

import cgi

def main():
    form = cgi.FieldStorage()
    print "Content-type: text/html"
    print
    if not form:
        print "<h1>No Form Keys</h1>"
    else:
        print "<h1>Form Keys</h1>"
        for key in form.keys():
            value = form[key].value
            print "<p>", cgi.escape(key), ":", cgi.escape(value)

if __name__ == "__main__":
    main()
cgi3.pyo000064400000000506150400404610006115 0ustar00�
Afc@sFdZddlZej�ddlmZedkrBe�ndS(sCGI test 3 (persistent data).i����N(tmaint__main__(t__doc__tcgitbtenabletwikiRt__name__(((s%/usr/lib64/python2.7/Demo/cgi/cgi3.pyt<module>s

cgi1.py000075500000000620150400404610005734 0ustar00#! /usr/bin/python2.7

"""CGI test 1 - check server setup."""

# Until you get this to work, your web server isn't set up right or
# your Python isn't set up right.

# If cgi0.sh works but cgi1.py doesn't, check the #! line and the file
# permissions.  The docs for the cgi.py module have debugging tips.

print "Content-type: text/html"
print
print "<h1>Hello world</h1>"
print "<p>This is cgi1.py"
cgi3.pyc000064400000000506150400404610006101 0ustar00�
Afc@sFdZddlZej�ddlmZedkrBe�ndS(sCGI test 3 (persistent data).i����N(tmaint__main__(t__doc__tcgitbtenabletwikiRt__name__(((s%/usr/lib64/python2.7/Demo/cgi/cgi3.pyt<module>s

wiki.pyo000064400000012401150400404610006230 0ustar00�
��^c@skdZddlZddlZddlZddlZddlZejZd�Zddd��YZdS(s0Wiki main program.  Imported and run by cgi3.py.i����NcCsotj�}dGHH|jdd�}|jdd�}t|�}t|d|d�p^|j}||�dS(NsContent-type: text/htmltcmdtviewtpaget	FrontPagetcmd_(tcgitFieldStoragetgetvaluetWikiPagetgetattrtNonetcmd_view(tformRRtwikitmethod((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytmainsRcBs�eZej�Zejjej	d�Z
d�Zd�Zd�Z
dd�Zd�Zd�Zd�Zd	�Zdd
�Zd�Zd�Zd
�ZRS(icCs2|j|�std�n||_|j�dS(Nspage name is not a wiki word(t
iswikiwordt
ValueErrortnametload(tselfR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt__init__s	cCs�dGt|j|j��GdGHdGHx?|jj�D].}|j�}|sTdGHq4|j|�GHq4WdGHdG|jd|jd�dGH|jdd	d
�dGHdS(Ns<h1>s</h1>s<p>s<hr>teditsEdit this paget;RRsgo to front paget.(tescapet
splitwikiwordRtdatat
splitlinestrstript
formatlinetmklink(RRtline((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRscCs�g}x�tjd|�D]}}|j|�r}tjj|j|��ra|jd||�}q�|jd||d�}nt|�}|j	|�qWdj
|�S(Ns(\W+)Rtnewt*t(tretsplitRtostpathtisfiletmkfileRRtappendtjoin(RR twordstword((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR(stChangecCsZdG|G|jGdGHd|jGHd}||jGHdGHd|jGHdGHd|GHd	GHdS(
Ns<h1>s</h1>s <form method="POST" action="%s">s7<textarea cols="70" rows="20" name="text">%s</textarea>s/<input type="hidden" name="cmd" value="create">s,<input type="hidden" name="page" value="%s">s<br>s%<input type="submit" value="%s Page">s</form>(Rt	scripturlR(RRtlabelts((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytcmd_edit5s	cCs�|jdd�j�|_|j�}|rIdGHdGHdGt|�GHnJdGHd}||jd|jGHdGHd	GHd
G|jd|j|j�GHdS(NttextR#s%<h1>I'm sorry.  That didn't work</h1>s8<p>An error occurred while attempting to write the file:s<p>s<head>s/<meta http-equiv="refresh" content="1; URL=%s">s?cmd=view&page=s<h1>OK</h1>s)<p>If nothing happens, please click here:R(RtstripRtstoreRR/RR(RRterrorR1((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt
cmd_create@scCs|j|dd�dS(NR0tCreate(R2(RR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytcmd_newQscCstjd|�S(Ns[A-Z][a-z]+([A-Z][a-z]*)+(R$tmatch(RR-((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRTscCsSg}x=|D]5}|r5|j�r5|jd�n|j|�q
Wdj|�S(Nt R#(tisupperR*R+(RR-tcharstc((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRWs
cCs2|dkr|j}ntjj|j|d�S(Ns.txt(R
RR&R'R+thomedir(RR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR)_scCs'|jd|d|}d||fS(Ns?cmd=s&page=s<a href="%s">%s</a>(R/(RRRR3tlink((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRdscCsYy2t|j��}|j�j�}|j�Wntk
rKd}nX||_dS(NR#(topenR)treadR4tclosetIOErrorR(RtfR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRhs

cCs�|j}yZt|j�d�}|j|�|rT|jd�rT|jd�n|j�dSWntk
r�}dt|�SXdS(Ntws
R#sIOError: %s(RRAR)twritetendswithRCRDtstr(RRREterr((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR5qs	

N(t__name__t
__module__ttempfilet
gettempdirR?R&R'tbasenametsystargvR/RRRR2R7R9RRR
R)RRR5(((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRs		
	
							((	t__doc__R&R$RRPRMRRR(((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt<module>s<		
cgi1.pyo000064400000000427150400404610006115 0ustar00�
Afc@sdZdGHHdGHdGHdS(s CGI test 1 - check server setup.sContent-type: text/htmls<h1>Hello world</h1>s<p>This is cgi1.pyN(t__doc__(((s%/usr/lib64/python2.7/Demo/cgi/cgi1.pyt<module>scgi1.pyc000064400000000427150400404610006101 0ustar00�
Afc@sdZdGHHdGHdGHdS(s CGI test 1 - check server setup.sContent-type: text/htmls<h1>Hello world</h1>s<p>This is cgi1.pyN(t__doc__(((s%/usr/lib64/python2.7/Demo/cgi/cgi1.pyt<module>swiki.pyc000064400000012401150400404610006214 0ustar00�
��^c@skdZddlZddlZddlZddlZddlZejZd�Zddd��YZdS(s0Wiki main program.  Imported and run by cgi3.py.i����NcCsotj�}dGHH|jdd�}|jdd�}t|�}t|d|d�p^|j}||�dS(NsContent-type: text/htmltcmdtviewtpaget	FrontPagetcmd_(tcgitFieldStoragetgetvaluetWikiPagetgetattrtNonetcmd_view(tformRRtwikitmethod((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytmainsRcBs�eZej�Zejjej	d�Z
d�Zd�Zd�Z
dd�Zd�Zd�Zd�Zd	�Zdd
�Zd�Zd�Zd
�ZRS(icCs2|j|�std�n||_|j�dS(Nspage name is not a wiki word(t
iswikiwordt
ValueErrortnametload(tselfR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt__init__s	cCs�dGt|j|j��GdGHdGHx?|jj�D].}|j�}|sTdGHq4|j|�GHq4WdGHdG|jd|jd�dGH|jdd	d
�dGHdS(Ns<h1>s</h1>s<p>s<hr>teditsEdit this paget;RRsgo to front paget.(tescapet
splitwikiwordRtdatat
splitlinestrstript
formatlinetmklink(RRtline((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRscCs�g}x�tjd|�D]}}|j|�r}tjj|j|��ra|jd||�}q�|jd||d�}nt|�}|j	|�qWdj
|�S(Ns(\W+)Rtnewt*t(tretsplitRtostpathtisfiletmkfileRRtappendtjoin(RR twordstword((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR(stChangecCsZdG|G|jGdGHd|jGHd}||jGHdGHd|jGHdGHd|GHd	GHdS(
Ns<h1>s</h1>s <form method="POST" action="%s">s7<textarea cols="70" rows="20" name="text">%s</textarea>s/<input type="hidden" name="cmd" value="create">s,<input type="hidden" name="page" value="%s">s<br>s%<input type="submit" value="%s Page">s</form>(Rt	scripturlR(RRtlabelts((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytcmd_edit5s	cCs�|jdd�j�|_|j�}|rIdGHdGHdGt|�GHnJdGHd}||jd|jGHdGHd	GHd
G|jd|j|j�GHdS(NttextR#s%<h1>I'm sorry.  That didn't work</h1>s8<p>An error occurred while attempting to write the file:s<p>s<head>s/<meta http-equiv="refresh" content="1; URL=%s">s?cmd=view&page=s<h1>OK</h1>s)<p>If nothing happens, please click here:R(RtstripRtstoreRR/RR(RRterrorR1((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt
cmd_create@scCs|j|dd�dS(NR0tCreate(R2(RR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pytcmd_newQscCstjd|�S(Ns[A-Z][a-z]+([A-Z][a-z]*)+(R$tmatch(RR-((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRTscCsSg}x=|D]5}|r5|j�r5|jd�n|j|�q
Wdj|�S(Nt R#(tisupperR*R+(RR-tcharstc((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRWs
cCs2|dkr|j}ntjj|j|d�S(Ns.txt(R
RR&R'R+thomedir(RR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR)_scCs'|jd|d|}d||fS(Ns?cmd=s&page=s<a href="%s">%s</a>(R/(RRRR3tlink((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRdscCsYy2t|j��}|j�j�}|j�Wntk
rKd}nX||_dS(NR#(topenR)treadR4tclosetIOErrorR(RtfR((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRhs

cCs�|j}yZt|j�d�}|j|�|rT|jd�rT|jd�n|j�dSWntk
r�}dt|�SXdS(Ntws
R#sIOError: %s(RRAR)twritetendswithRCRDtstr(RRREterr((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyR5qs	

N(t__name__t
__module__ttempfilet
gettempdirR?R&R'tbasenametsystargvR/RRRR2R7R9RRR
R)RRR5(((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyRs		
	
							((	t__doc__R&R$RRPRMRRR(((s%/usr/lib64/python2.7/Demo/cgi/wiki.pyt<module>s<		
wiki.py000064400000007705150400404610006064 0ustar00"""Wiki main program.  Imported and run by cgi3.py."""

import os, re, cgi, sys, tempfile
escape = cgi.escape

def main():
    form = cgi.FieldStorage()
    print "Content-type: text/html"
    print
    cmd = form.getvalue("cmd", "view")
    page = form.getvalue("page", "FrontPage")
    wiki = WikiPage(page)
    method = getattr(wiki, 'cmd_' + cmd, None) or wiki.cmd_view
    method(form)

class WikiPage:

    homedir = tempfile.gettempdir()
    scripturl = os.path.basename(sys.argv[0])

    def __init__(self, name):
        if not self.iswikiword(name):
            raise ValueError, "page name is not a wiki word"
        self.name = name
        self.load()

    def cmd_view(self, form):
        print "<h1>", escape(self.splitwikiword(self.name)), "</h1>"
        print "<p>"
        for line in self.data.splitlines():
            line = line.rstrip()
            if not line:
                print "<p>"
            else:
                print self.formatline(line)
        print "<hr>"
        print "<p>", self.mklink("edit", self.name, "Edit this page") + ";"
        print self.mklink("view", "FrontPage", "go to front page") + "."

    def formatline(self, line):
        words = []
        for word in re.split('(\W+)', line):
            if self.iswikiword(word):
                if os.path.isfile(self.mkfile(word)):
                    word = self.mklink("view", word, word)
                else:
                    word = self.mklink("new", word, word + "*")
            else:
                word = escape(word)
            words.append(word)
        return "".join(words)

    def cmd_edit(self, form, label="Change"):
        print "<h1>", label, self.name, "</h1>"
        print '<form method="POST" action="%s">' % self.scripturl
        s = '<textarea cols="70" rows="20" name="text">%s</textarea>'
        print s % self.data
        print '<input type="hidden" name="cmd" value="create">'
        print '<input type="hidden" name="page" value="%s">' % self.name
        print '<br>'
        print '<input type="submit" value="%s Page">' % label
        print "</form>"

    def cmd_create(self, form):
        self.data = form.getvalue("text", "").strip()
        error = self.store()
        if error:
            print "<h1>I'm sorry.  That didn't work</h1>"
            print "<p>An error occurred while attempting to write the file:"
            print "<p>", escape(error)
        else:
            # Use a redirect directive, to avoid "reload page" problems
            print "<head>"
            s = '<meta http-equiv="refresh" content="1; URL=%s">'
            print s % (self.scripturl + "?cmd=view&page=" + self.name)
            print "<head>"
            print "<h1>OK</h1>"
            print "<p>If nothing happens, please click here:",
            print self.mklink("view", self.name, self.name)

    def cmd_new(self, form):
        self.cmd_edit(form, label="Create")

    def iswikiword(self, word):
        return re.match("[A-Z][a-z]+([A-Z][a-z]*)+", word)

    def splitwikiword(self, word):
        chars = []
        for c in word:
            if chars and c.isupper():
                chars.append(' ')
            chars.append(c)
        return "".join(chars)

    def mkfile(self, name=None):
        if name is None:
            name = self.name
        return os.path.join(self.homedir, name + ".txt")

    def mklink(self, cmd, page, text):
        link = self.scripturl + "?cmd=" + cmd + "&page=" + page
        return '<a href="%s">%s</a>' % (link, text)

    def load(self):
        try:
            f = open(self.mkfile())
            data = f.read().strip()
            f.close()
        except IOError:
            data = ""
        self.data = data

    def store(self):
        data = self.data
        try:
            f = open(self.mkfile(), "w")
            f.write(data)
            if data and not data.endswith('\n'):
                f.write('\n')
            f.close()
            return ""
        except IOError, err:
            return "IOError: %s" % str(err)
cgi0.sh000075500000000232150400404610005714 0ustar00#! /bin/sh

# If you can't get this to work, your web server isn't set up right

echo Content-type: text/plain
echo
echo Hello world
echo This is cgi0.sh