Beispiel #1
0
def testProjectTitlePage(projectTitle, apiKey):

	#check if the api key is valid
	#apiKey = request.form.get('apikey')

	if apiKey == None or apiKey == '':
		return '/error=Error: bad api key'

	#get the user of the api key 
	userId = databaseFunctions.getApiKeyUserId(apiKey)

	if userId == None or userId == '':
		return '/error=Error: bad api key'

	userInfo = databaseFunctions.getUserInfo(userId)
	
	#hit the stats 

	#find the project
	projectId = databaseFunctions.getTitleProjectId(projectTitle)
	
	if projectId == None:
		return '/error=Error: Bad Project Name'
	
	projectInfo = databaseFunctions.getProjectInfo(projectId)
	
	databaseFunctions.addUserHit(userId, projectId)
	databaseFunctions.addProjectHit(userId)

	try:
		r = requests.post(projectInfo['secretUrl'], data=request.form.to_dict(flat=False))
	except Exception, e:
		return '/error=Error: bad secret url: ' + projectInfo.get('secretUrl')
Beispiel #2
0
def editServicePage(serviceId):
	if login.current_user.isAdmin == 'False':
		return redirect('/')

	serviceInfo = databaseFunctions.getProjectInfo(serviceId)
	serviceInfo['id'] = serviceId
	return render_template('addService.html', serviceInfo=serviceInfo, formAction="editServiceSubmit")
Beispiel #3
0
def showProject(projectId):
    projectInfo = databaseFunctions.getProjectInfo(projectId)
    stats = databaseFunctions.getAllUserHits(login.current_user.get_id(),
                                             projectId)
    return render_template("project.html",
                           projectInfo=projectInfo,
                           stats=stats)
Beispiel #4
0
def showIndex(errors=[]):
	if request.args.get('error') != None:
		errors = [{'message':request.args.get('error'),'class':'bg-danger'}]

	recentProjectsIds = databaseFunctions.getProjectListRange(0, -1)
	recentProjects = []
	for projectId in recentProjectsIds:
		recentProjects.append( databaseFunctions.getProjectInfo(projectId) )

	return render_template("index.html", recentProjects=recentProjects, errors=errors)
Beispiel #5
0
def editServiceSubmitPage():
	if login.current_user.isAdmin == 'False':
		return redirect('/')

	projectInfo = databaseFunctions.getProjectInfo(request.form.get('existingId'))
	#remove the stuff
#	print "projectInfo['title'].split()"
#	print projectInfo['title'].split()
	deleteProjectFromTags(projectId, projectInfo['title'].split())
#	print "projectInfo['Description'].split()"
#	print projectInfo['Description'].split()
	deleteProjectFromTags(projectId, projectInfo['Description'].split())
#	print "projectInfo['tags']"
#	print projectInfo['tags']
	deleteProjectFromTags(projectId, projectInfo['tags'])


	tagsList = request.form.get('tags')#do the title and other stuff !!!!
	databaseFunctions.deleteProjectFromTags(request.form.get('existingId'), tagsList)

	databaseFunctions.editProject(
			request.form.get('existingId'),
			request.form.get('serviceurl'), 
			request.form.get('uname'), 
			request.form.get('title'), 
			request.form.get('Author'), 
			request.form.get('sourcecode'), 				
			request.form.get('description'), 
			request.form.get('input'), 
			request.form.get('output'), 
			request.form.get('requirements'),
			request.form.get('usage'),
			request.form.get('example'), 
			request.form.get('tags'))

	return redirect('/dashboard?success=Success: Service Edited')