def post(self): datastore = DataStoreInterface() email = self.request.get('txtEmail') first = self.request.get('txtFirstName') last = self.request.get('txtLastName') #password code should go here company = self.request.get('txtCompanyName') street = self.request.get('txtStreetAddress') city = self.request.get('txtCity') state = self.request.get('txtState') zip = self.request.get('txtZip') country = self.request.get('txtCountry') phone = self.request.get('txtPhoneNumber') site = self.request.get('txtWebsite') #self.response.out.write(company) userAttributes = [first, last] companyAttributes = [company, street, city, state, zip, country, phone, site] if ((datastore.changeCompanyInfo(company, companyAttributes)) and (datastore.changeUserInfo(email, userAttributes))): render.doRender(self, 'controlpanel.html', {'message':'Changed Information'}) else: render.doRender(self, 'settings.html', {'error':'Could not change in database'})
def get(self): self.session = Session() if 'user' in self.session: user = self.session['user'] params = (self.request.url).split('?')[1].split('&') render.doRender(self, 'reply.html', {'user': user, 'name': '@' + params[2].split('=')[1]}) else: self.redirect('main.html')
def get(self): self.session = Session() if 'user' in self.session: user = self.session['user'] render.doRender(self, 'reply.html', {'user': user}) else: self.redirect('main.html')
def get(self): fb = facebook.Facebook(API_KEY, SECRET_KEY) url = urlparse(self.request.url) params = dict([part.split('=') for part in url[4].split('&')]) userInfo = fb.__call__('Users.getInfo', {'session_key':params['fb_sig_session_key'], 'call_id':time(), 'uids':[params['fb_sig_user']], 'fields':['first_name', 'last_name']}) render.doRender(self,'facebookcallback.html', {'currentUser':params['fb_sig_user'], 'token':params['auth_token'], 'firstn':userInfo[0]['first_name'], 'lastn':userInfo[0]['last_name']})
def post(self): datastore = DataStoreInterface() email = datastore.getAdminEmail('synapsync') if (email <> 'null'): emailObj = EmailProcessor() subject = self.request.get('txtSubject') body = self.request.get('txtContent') emailObj.sendSupportEmail(email, subject, body) render.doRender(self,'contact.html', {'confirmation' : 'Email sent!'})
def get(self): path = (self.request.path).replace('/', '') datastore = DataStoreInterface() if (path <> '') and (path <> 'main.html'): if (datastore.companyProfileExists(path) == 1): path = 'profiles.html?company='+path self.redirect(path) else: self.response.out.write('404: File not Found') else: render.doRender(self,'main.html', {})
def startGameLoop(self): #Main game loop while True: event.doEvent(self) if self.gameOver == True: break update.doUpdate(self) render.doRender(self) pygame.time.delay(40)
def get(self): datastore = DataStoreInterface() formatter = StringFormatter() path = self.request.query_string params = path.split('/') company = params[0].replace('company=','') postId = params[1].replace('id=','') post = datastore.getPost(company, postId) for p in post: update = formatter.formatPost(p, company) render.doRender(self, 'update.html', {'update' : update})
def get(self): datastore = DataStoreInterface() formatter = StringFormatter() path = self.request.query_string.replace('company=', '') posts = datastore.getPosts(path, 25) companies = datastore.getCompanyInfo(path) company = datastore.getCompanyName(path) info='' for c in companies: info = formatter.formatCompanyInfo(c) postList=[] for p in posts: postList.append(formatter.formatPost(p, p.dbProfileName)) render.doRender(self, 'profiles.html', {'posts': postList, 'company': company , 'info': info, 'profileName' : path})
def post(self): email = self.request.get('txtEmail') datastore = DataStoreInterface() emailObj = EmailProcessor() if emailObj.isValidEmail(email) <> 1: render.doRender(self, 'retrieve.html', {'error' : 'Invalid email address format!'}) elif datastore.userExists(email) <> 1: render.doRender(self, 'retrieve.html', {'error' : 'Email address has not been registered!'}) else: subject = "SynapSync email password Retrieval for " + email password = datastore.getUserPass(email) body = """ Hi, You are receiving the following email because your password was requested. Your info is: email: """ + email + """ password: """ + password + """ Thanks, SynapSync Team""" emailObj.sendSupportEmail(email, subject, body) render.doRender(self,'retrieve.html', {'confirmation' : 'Password sent to ' + email})
def post(self): self.session = Session() datastore = DataStoreInterface() email = self.request.get('txtEmail').strip() password = self.request.get('txtPassword') self.session.delete_item('user') #Check for any fields left empty if email == '' or password == '': render.doRender(self, 'main.html', {'error' : 'Please fill in all the details'}) return username = datastore.loginUser(email, password) if datastore.isUser(email)== 1: if datastore.checkPass(email, password)==1: self.session['user'] = username self.redirect('controlpanel.html') else: render.doRender(self, 'main.html', {'error' : 'Wrong password'}) else: render.doRender(self, 'main.html', {'error' : 'Email Address does not exist'})
def get(self): self.session = Session() if 'user' in self.session: formatter = StringFormatter() user = self.session['user'] company = formatter.getCompanyProfileName(user) email = formatter.getEmail(user) datastore = DataStoreInterface() twitterAccounts = datastore.getTwitterAccounts(company) facebookAccounts = datastore.getFacebookAccounts(company) uInfo = datastore.getUserInfo(email) for u in uInfo: firstName = u.dbFirstName lastName = u.dbLastName cInfo = datastore.getCompanyInfo(company) for c in cInfo: cname = c.dbCompanyName stAddress = c.dbStreetAddress city = c.dbCity state = c.dbState zip = c.dbPostalCode country = c.dbCountry number = c.dbPhoneNumber cemail = c.dbAdministrator website = c.dbUrl if datastore.isAdmin(company, email) == 1: render.doRender(self, 'settings.html', {'isAdmin':email,'email':email,'firstName':firstName, 'lastName':lastName, 'socialAccounts' : twitterAccounts ,'facebookAccounts':facebookAccounts, 'cname':cname, 'stAddress':stAddress, 'city':city, 'state':state, 'zip':zip ,'country':country, 'number':number, 'cemail':cemail, 'website':website }) else: render.doRender(self, 'settings.html', {'email':email}) else: render.doRender(self, 'main.html', {})
def get(self): render.doRender(self, 'retrieve.html', {})
def get(self): render.doRender(self, 'register.html', {})
def post(self): if (self.request.get('txtInviteCode') == 'SYNAPSE'): self.session = Session() datastore = DataStoreInterface() #collection of text box contents firstName = self.request.get('txtFirstName') lastName = self.request.get('txtLastName') company = self.request.get('txtCompany') email = self.request.get('txtEmail') password = self.request.get('txtPass1') repassword = self.request.get('txtPass2') #create session variable self.session.delete_item('user') #create emailPOrcessor object emailObj = EmailProcessor() #check email address validity if emailObj.isValidEmail(email) == 0: render.doRender(self, 'register.html', {'error' : 'Invalid email address. Please input a valid email address.'}) return #Ensure that the passwords match if password <> repassword: render.doRender(self, 'register.html', {'error' : 'Password did not match'}) return #Check for any fields left empty if firstName == '' or lastName == '' or company == '' or email == '' or password == '' or repassword == '': render.doRender(self, 'register.html', {'error' : 'Please fill in all the details'}) return #See if the user already exists in the database if datastore.userExists(email) == 1: render.doRender(self, 'register.html', {'error' : 'The account associated with the email already exists'}) return #check if company exists #IF it doesn't THEN add user as administrator and create company ELSE add user as editor if datastore.companyExists(company) == 0: if datastore.addUser([email, password, firstName, lastName, company, 'Administrator']) == 0: self.doRender(self, 'register.html', {'error' : 'Database could not add User: Adding a new user requires 6 attributes to be specified.'}) return profileName = company.replace(' ', '').lower() if datastore.addCompany([company, profileName, email]) == 0: self.doRender(self, 'register.html', {'error' : 'Database could not add Company: Adding a new company requires 3 attributes to be specified.'}) return else: if datastore.addUser([email, password, firstName, lastName, company, 'Editor']) == 0: self.doRender(self, 'register.html', {'error' : 'Database could not add User: Adding a new user requires 6 attributes to be specified.'}) return #create session variable based on email and company name username = company + " - " + email self.session['user'] = username self.redirect('controlpanel.html') else: render.doRender(self, 'register.html', {'error' : 'Sorry at this time SynapSync is open only to a limited number of users. Please check back at another time. <br><br>Thanks,<br> The SynapSync Team'})
def get(self): render.doRender(self, 'contact.html', {'company':'synapsync'})
def get(self): self.session = Session() if 'user' in self.session: user = self.session['user'] datastore = DataStoreInterface() formatter = StringFormatter() company = formatter.getCompanyProfileName(user) email = formatter.getEmail(user) twitter_oauth_handler.setTwitterAccounts(company) twitterAccounts = twitter_oauth_handler.getTwitterAccounts() facebookAccounts = datastore.getFacebookAccounts(company) #TWITTER MENTIONS QUERIED mentions = [] for name in twitterAccounts: numMention = 0 client = OAuthClient('twitter', self, name) statuses = client.get('/statuses/mentions') if statuses == "Could not retrieve from social networks. The server could not be contacted at this time. Please try again later.": self.response.out.write(statuses) return for iteration in statuses: numMention += 1 mention = Mentions() mention.dbCreatedTime = iteration['created_at'] mention.dbMessage = iteration['text'] mention.dbName = iteration['user']['screen_name'] mention.dbPostID = str(iteration['id']) mention.dbReceiverName = iteration['in_reply_to_screen_name'] mention.dbLink = 'From: <a href="http://twitter.com/' + iteration['user']['screen_name']+'" target="_blank">'+ iteration['user']['name'] + '</a>' mentions.append(mention) if numMention == 5: break comments = [] for name in facebookAccounts: fb = facebook.Facebook(API_KEY, SECRET_KEY) stream = fb.__call__('Stream.get', {'session_key':name.dbSessionKey, 'source_ids':[name.dbUid], 'limit':5}) for post in stream['posts']: replies = post['comments']['comment_list'] numComment = 0 for reply in replies: userInfo = fb.__call__('Users.getInfo', {'session_key':name.dbSessionKey, 'call_id':time(), 'uids':reply['fromid'], 'fields':['first_name', 'last_name']}) username = userInfo[0]['first_name'] + ' ' + userInfo[0]['last_name'] status = Comments() status.dbUserID = name.dbUid status.dbPostID = post['post_id'] status.dbMessage = reply['text'] status.dbLink = 'From: <a href="http://www.facebook.com/profile.php?ref=profile&id=' + str(reply['fromid']) + '" target="_blank">' + username + '</a>' status.dbReplyTo = 'In reply to: ' + post['message'] comments.append(status) numComment += 1 if numComment == 3: break if len(comments) == 10: break #getting saved posts datastore = DataStoreInterface() formatter = StringFormatter() profileName = formatter.getCompanyProfileName(user) posts = datastore.getSavedPosts(profileName, 25) savedPosts = '' for r in posts: savedPosts += formatter.formatSavedPost(r, formatter.formatPost(r, profileName)) #upload_url = blobstore.create_upload_url('/upload') render.doRender(self, 'controlpanel.html', {'user': user, 'mentions': mentions, 'comments':comments, 'savedPosts': savedPosts, 'socialAccounts': twitterAccounts, 'facebookAccounts':facebookAccounts}) else: self.redirect('main.html')