#!/home3/zenmagic/python/bin/python import cgi import cgitb; cgitb.enable() import urllib import re import sys import os import shutil import zipfile from os.path import isdir, isfile, join, normpath, split import datetime whowashere="zag" zigorzag=whowashere whowashere="" #mydirectory=os.path.abspath( __file__ ) #mydirectory=re.sub("/home3/zenmagic/public_html/","",mydirectory) #mydirectory=re.sub("/zigzag.py","",mydirectory) #if (len(mydirectory) == 5) : mxx=mydirectory linknames=[] linknames.append(" zero") linknames.append(" table of contents") linknames.append(" chapter 1") linknames.append(" chapter 2") linknames.append(" chapter 3") linknames.append(" chapter 4") linknames[2]="toc" saveanames=[] saveanames.append(" zero") saveanames.append(" table of contents") saveanames.append(" chapter 1") saveanames.append(" chapter 2") saveanames.append(" chapter 3") saveanames.append(" chapter 4") isapi=0 form=cgi.FieldStorage() whatbook='' newtext='' ed='' #ed='ed' s='' zigwashere="" zagwashere="" if 'z' in form : zigorzag=str(form['z'].value) if (zigorzag != "zig") and (zigorzag != "zag") : zigorzag=whowashere if 'z' in form : whowashere=str(form['z'].value) if 'newtext' in form : newtext=str(form['newtext'].value) if newtext == "hello world..." : newtext="" if newtext != "" : writefile = open('zig.zml','w') writefile.write(newtext) writefile.close f = urllib.urlopen('http://zenmagiclove.com/zigzag.zml') s="" if f != '' : s = f.read() f.close() isapi=0 if newtext != '' : s=' '+newtext.strip()+'\n\n' s=re.sub('\r\n','\n',s) s=re.sub('\r\n','\n',s) s=re.sub('\r','\n',s) s=re.sub('\r','\n',s) s=re.sub(' \n','\n',s) s=re.sub(' \n','\n',s) s=re.sub(' \n','\n',s) s=re.sub(' \n','\n',s) s=re.sub(' \n','\n',s) print 'Content-type: text/html\n' #input = sys.stdin.read() #if input != "" : print input #if input == "" : print "no input" #if "zig" in input : # zigorzag="zig" # print "zig says hello... " # print " ...but zag ignores him" # zigorzag="zag" #zigorzag="zag" #print "form=" #print form #if "z" in form : # print "zig in form, but zag ignores him" zigwashere="false" zagwashere="false" if whowashere == "zig" : zigwashere="true" if whowashere == "zag" : zagwashere="true" html5=""" \n zigzag.py """ # # # # print html5 ff = urllib.urlopen('http://zenmagiclove.com/zml/suite/mobi/suite-html5.html') sss="" if ff != '' : sss = ff.read() ff.close() ssss=sss[0:sss.find("\n" if isapi == 0: print '