Media finder

This commit is contained in:
CHIEFSOFT\ameye
2023-08-10 20:05:44 -04:00
parent 8ac4497206
commit f9b7fb4fe7
4 changed files with 131 additions and 13 deletions
+86
View File
@@ -0,0 +1,86 @@
// History Listing
#include "clog.h"
#include "cgi.h"
#include "input.h"
#include "wrenchboard_api.h"
#include "history.h"
#include "media.h"
#include "email.h"
#include "payments.h"
#include "safestring.h"
#include <string>
#include "pgsql.h"
#include "pgsql_wrapper.h"
#include "cfg.h"
#include <curl/curl.h>
/*
CREATE TABLE members_myfiles (
id SERIAL,
member_id INT REFERENCES members(id) NOT NULL,
uid uuid DEFAULT uuid_generate_v4(),
file_name VARCHAR(35),
saved_file_name VARCHAR(35) UNIQUE NOT NULL,
file_size INT DEFAULT 0,
file_type VARCHAR(15),
title VARCHAR(35),
description VARCHAR(100),
status INT DEFAULT 1,
added timestamp without time zone DEFAULT now(),
updated timestamp without time zone DEFAULT now()
);
ALTER TABLE ONLY members_myfiles
ADD CONSTRAINT members_myfiles_id_key UNIQUE (id);
*/
/* This profile apps*/
long WrenchFindStoredMedia(CVars in, CVars &out) {
logfmt(logINFO, "WrenchUpdateUserProfile()");
long ret = PHP_API_BAD_PARAM;
try {
REQ_STRING(in, "firstname", 3, 49, "(.*)");
REQ_STRING(in, "lastname", 3, 49, "(.*)");
REQ_STRING(in, "email", 5, 150, "(.*)");
REQ_STRING(in, "state", 3, 150, "(.*)");
REQ_STRING(in, "city", 3, 150, "(.*)");
long member_id = REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "uid", 3, 150, "(.*)");
OPTIONAL(in, "online_name") REQ_STRING(in, "online_name", 3, 15, "(.*)");
REQ_LONG(in, "pref_email", 1, -1);
REQ_LONG(in, "pref_phone", 1, -1);
const PGresult *res;
res = pgsql_query("SELECT * FROM members WHERE id = %lu AND uid='%s'", member_id, in["uid"].c_str() );
if (res != NULL && pgsql_num_rows(res) > 0) {
CVars x;
x["firstname"] = in["firstname"];
x["firstname"].set_valid(true);
x["lastname"] = in["lastname"];
x["lastname"].set_valid(true);
x["email"] = in["email"];
x["email"].set_valid(true);
x["state"] = in["state"];
x["state"].set_valid(true);
x["city"] = in["city"];
x["city"].set_valid(true);
x["online_name"] = in["online_name"];
x["online_name"].set_valid(true);
x["pref_email"] = in["pref_email"];
x["pref_email"].set_valid(true);
x["pref_phone"] = in["pref_phone"];
x["pref_phone"].set_valid(true);
update_db_record(DBS_VALID, "members", x, member_id);
ret = PHP_API_OK;
}
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long WrenchUpdateUserProfile(CVars in, CVars &out)");
}
logfmt(logINFO, "/WrenchUpdateUserProfile()");
return ret;
}
@@ -22,6 +22,7 @@
#include "coupons.h"
#include "cards.h"
#include "family_acc.h"
#include "media.h"
#include "twilo.h"
//extern CSQL *sql;