deletes and fixes
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
//megnézzük, hogy a KID benne van-e olyan category-val, ami az adott grouphoz tartozik
|
||||
//megnézzük, hogy a KID benne van-e olyan category-val, ami az adott grouphoz tartozik
|
||||
//ha igen, akkor, akkor updateljük a categoryját
|
||||
//ha nem, akkor beszúrjuk az új category ID-val
|
||||
if ($_POST['category_id'] == 'null') {
|
||||
@@ -36,7 +36,7 @@ if ($sql->num_of_rows($ugk_query)) {
|
||||
}
|
||||
else {
|
||||
$sql->update_table('user_group_kid', array('ugk_category_ugc_id' => $_POST['category_id']), array('ugk_id' => $ugk_id));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,4 +60,4 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
include('class_user_parent.php');
|
||||
include('class_user_kid.php');
|
||||
include('class_user_group.php');
|
||||
include('class_user_group_filter.php');
|
||||
include('class_user_group_filter_value.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
$all_kid = array();
|
||||
|
||||
if (empty($_POST['filter_array'])) {
|
||||
echo json_encode(null);
|
||||
}
|
||||
else {
|
||||
//updatelni kell az user_group_filter_value, aztán apply-olni
|
||||
user_group::empty_group($_POST['user_group_id']);
|
||||
foreach ($_POST['filter_array'] as $key => $filter_value) {
|
||||
//[0] => filter_value_id, [1] => value, [2] => filter_id
|
||||
if ($filter_value[1] == 'null') {
|
||||
$sql->execute_query('DELETE FROM user_group_filter_value WHERE ugfv_id = ' . $filter_value[0]);
|
||||
}
|
||||
else {
|
||||
$sql->update_table('user_group_filter_value', array(
|
||||
'ugfv_filter_id' => $filter_value[2],
|
||||
'ugfv_group_id' => $_POST['user_group_id'],
|
||||
'ugfv_value' => $filter_value[1],
|
||||
), array(
|
||||
'ugfv_id' => $filter_value[0],
|
||||
));
|
||||
|
||||
|
||||
|
||||
$ugfv_obj = new user_group_filter_value();
|
||||
$ugfv_obj->set_ugfv_data_by_id($filter_value[0]);
|
||||
$ugfv_obj->apply($_POST['intersect']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
echo json_encode($sql->insert_into('user_group_category', array(
|
||||
'ugc_name' => $_POST['category_name'],
|
||||
'ugc_user_group_ug_id' => $_POST['group_id']
|
||||
)));
|
||||
|
||||
?>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
echo json_encode($sql->insert_into('user_group_filter_value', array()));
|
||||
|
||||
?>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
//paraméterek: group_id, category_id
|
||||
//ha nincs category_id, akkor mindenki
|
||||
|
||||
function get_value_parts($str) {
|
||||
$parts = explode(',', $str);
|
||||
return $parts;
|
||||
}
|
||||
|
||||
$user_kid_query = "
|
||||
SELECT
|
||||
uk_id,
|
||||
uk_name,
|
||||
ugk_id,
|
||||
GROUP_CONCAT(distinct ugk_id) ugk_ids,
|
||||
GROUP_CONCAT(distinct ugc_id order by ugc_id) ugc_ids,
|
||||
GROUP_CONCAT(ugc_name) ugc_names,
|
||||
GROUP_CONCAT(distinct ugk_ugfv_id) ugfv_ids,
|
||||
GROUP_CONCAT(distinct if(ugf_table is null, 'null', ugf_table)) ugf_tables,
|
||||
GROUP_CONCAT(distinct if(ugf_value is null, 'null', ugf_value)) ugf_values,
|
||||
GROUP_CONCAT(distinct if(ugf_label is null, 'null', ugf_label)) ugf_labels
|
||||
|
||||
|
||||
FROM
|
||||
user_kid
|
||||
JOIN
|
||||
user_group_kid ON ugk_user_kid_uk_id = uk_id
|
||||
LEFT JOIN
|
||||
user_group_category ON ugc_id = ugk_category_ugc_id
|
||||
JOIN
|
||||
user_group_filter_value ON ugfv_id = ugk_ugfv_id
|
||||
JOIN
|
||||
user_group_filter ON ugf_id = ugfv_filter_id
|
||||
WHERE
|
||||
uk_deleted = 0 and uk_is_active = 1 and
|
||||
ugk_user_group_ug_id = ".$_POST['group_id'].""
|
||||
.($_POST['category_id']?" AND ugk_category_ugc_id = " . $_POST['category_id']:"").
|
||||
" GROUP BY uk_id
|
||||
ORDER BY uk_name ASC;
|
||||
";
|
||||
|
||||
$kid_array = $sql->assoc_array($user_kid_query);
|
||||
//var_dump($user_kid_query);
|
||||
|
||||
//szívás, ne módosítsuk
|
||||
foreach ($kid_array as $key => $kid_value) {
|
||||
$tables = get_value_parts($kid_value['ugf_tables']);
|
||||
$values_to_write = array();
|
||||
foreach ($tables as $index => $table_name) {
|
||||
if ('null' != $table_name && $kid_value['ugc_names']) {
|
||||
$values = get_value_parts($kid_value['ugf_values']);
|
||||
$value_field = $values[$index];
|
||||
$labels = get_value_parts($kid_value['ugf_labels']);
|
||||
$label_field = $labels[$index];
|
||||
$values_to_search = get_value_parts($kid_value['ugc_names']);
|
||||
//var_dump($values_to_search);
|
||||
$value_to_search = $values_to_search[$index];
|
||||
$values_to_write[] = $sql->single_variable('select '.$label_field.' from '.$table_name.' where '.$value_field.'='.$value_to_search);
|
||||
$query = 'select '.$label_field.' from '.$table_name.' where '.$value_field.'='.$value_to_search;
|
||||
}
|
||||
else {
|
||||
$names = get_value_parts($kid_value['ugc_names']);
|
||||
$values_to_write[] = $names[$index];
|
||||
}
|
||||
}
|
||||
$final_string = implode(',', $values_to_write);
|
||||
$kid_array[$key]['ugc_names'] = $final_string;
|
||||
}
|
||||
|
||||
echo json_encode($kid_array);
|
||||
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//lekérjük a labda típusokat
|
||||
$accom_assoc_array = $sql->assoc_array("SELECT * FROM camp_accomodation JOIN camp_accomodation_type on cat_id = ca_accomodation_id WHERE ca_camp_id = " . $_POST['camp_id']);
|
||||
|
||||
echo json_encode($accom_assoc_array);
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//lekérjük a labda típusokat
|
||||
$cc_assoc_array = $sql->assoc_array("SELECT * FROM camp_contact WHERE cc_id = " . $_POST['camp_contact_id']);
|
||||
|
||||
echo json_encode($cc_assoc_array);
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//lekérjük a labda típusokat
|
||||
$ck_assoc_array = $sql->assoc_array("SELECT * FROM camp_kid WHERE ck_id = " . $_POST['camp_kid_id']);
|
||||
|
||||
echo json_encode($ck_assoc_array);
|
||||
?>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//lekérjük a labda típusokat
|
||||
$shuttle_assoc_array = $sql->assoc_array("SELECT * FROM camp_shuttle JOIN camp_shuttle_type on cst_id = cs_shuttle_id WHERE cs_camp_id = " . $_POST['camp_id']);
|
||||
|
||||
$shuttle_array = array();
|
||||
foreach ($shuttle_assoc_array as $shuttle) {
|
||||
$shuttle_array[$shuttle['cst_id']] = $shuttle['cst_name'];
|
||||
}
|
||||
|
||||
echo json_encode($shuttle_assoc_array);
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
$category_query = "SELECT * FROM user_group_category WHERE ugc_id = " . $_POST['category_id'];
|
||||
|
||||
echo json_encode($sql->assoc_array($category_query));
|
||||
|
||||
?>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
$ugc_query = "SELECT * FROM user_group_category WHERE ugc_user_group_ug_id = " . $_POST['group_id'] . " ORDER BY ugc_name ASC";
|
||||
|
||||
$ugc_assoc_array = $sql->assoc_array($ugc_query);
|
||||
|
||||
echo json_encode($ugc_assoc_array);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
$ugc_query = "SELECT * FROM user_group_filter ORDER BY ugf_name ASC";
|
||||
|
||||
$ugc_assoc_array = $sql->assoc_array($ugc_query);
|
||||
|
||||
echo json_encode($ugc_assoc_array);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
$ugfv_query = "SELECT * FROM user_group_filter_value WHERE ugfv_group_id = " . $_POST['group_id'];
|
||||
|
||||
$ugfv_assoc_array = $sql->assoc_array($ugfv_query);
|
||||
|
||||
echo json_encode($ugfv_assoc_array);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
include('class_user_group_filter.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
if ($_POST['filter_id'] == 'null') {
|
||||
echo json_encode(null);
|
||||
}
|
||||
else {
|
||||
$ugf = new user_group_filter();
|
||||
$ugf->set_ugf_data_by_id($_POST['filter_id']);
|
||||
|
||||
//megvizsgáljuk, hogy külön táblából kell-e szedni az adatokat
|
||||
if ($ugf->get_ugf_table()) {
|
||||
$ugf_query = "SELECT DISTINCT ".$ugf->get_ugf_value()." AS ugf_id, ".$ugf->get_ugf_label()." AS ugf_name FROM " . $ugf->get_ugf_table() . " WHERE " . $ugf->get_ugf_condition();
|
||||
}
|
||||
else {
|
||||
$ugf_query = "SELECT DISTINCT uk_" . $ugf->get_ugf_field() . " AS ugf_id, uk_".$ugf->get_ugf_field()." as ugf_name FROM user_kid WHERE uk_".$ugf->get_ugf_field()." IS NOT NULL ORDER BY uk_" . $ugf->get_ugf_field() . " ASC;";
|
||||
}
|
||||
//var_dump($ugf_query);
|
||||
$ugf_assoc_array = $sql->assoc_array($ugf_query);
|
||||
|
||||
echo json_encode($ugf_assoc_array);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//ha members akkor minden AKTÍV, NEM TÖRÖLT kid-et lekéri, név szerint rendezve
|
||||
|
||||
$kid_query = "SELECT
|
||||
*
|
||||
FROM
|
||||
(SELECT
|
||||
uk_id,
|
||||
uk_name,
|
||||
ugk_id,
|
||||
uk_is_active,
|
||||
uk_deleted,
|
||||
ugk_user_group_ug_id,
|
||||
ugk_category_ugc_id
|
||||
FROM
|
||||
user_kid
|
||||
LEFT JOIN user_group_kid ON (ugk_user_kid_uk_id = uk_id
|
||||
AND ugk_id NOT IN (SELECT
|
||||
ugk_id
|
||||
FROM
|
||||
user_group_kid
|
||||
WHERE
|
||||
ugk_user_group_ug_id != ".$_POST['groupId']."))) subtbl
|
||||
WHERE
|
||||
(ugk_user_group_ug_id = ".$_POST['groupId']."
|
||||
OR ugk_user_group_ug_id IS NULL)
|
||||
AND uk_is_active = 1
|
||||
AND uk_deleted = 0
|
||||
AND (ugk_category_ugc_id NOT IN (SELECT
|
||||
ugc_id
|
||||
FROM
|
||||
user_group_category
|
||||
WHERE
|
||||
ugc_user_group_ug_id != ".$_POST['groupId'].")
|
||||
OR ugk_category_ugc_id IS NULL)";
|
||||
|
||||
|
||||
if (!empty($_POST['searchStr'])) {
|
||||
if ('members' == $_POST['searchStr']) {
|
||||
$kid_query = "select uk_id, uk_name, ugk_id, ugk_user_group_ug_id, ugk_category_ugc_id from user_kid
|
||||
left join user_group_kid on ugk_user_kid_uk_id = uk_id
|
||||
where ugk_user_group_ug_id = ".$_POST['groupId'];
|
||||
}
|
||||
elseif ('not_members' == $_POST['searchStr']) {
|
||||
$kid_query = " select uk_id, uk_name,
|
||||
(select count(*) from user_group_category where ugc_user_group_ug_id = ".$_POST['groupId']." and ugc_id = ugk_category_ugc_id) as thisGroup,
|
||||
if ((select count(*) from user_group_category where ugc_user_group_ug_id = ".$_POST['groupId']." and ugc_id = ugk_category_ugc_id), ugk_id, null) ugk_id,
|
||||
null ugk_user_group_ug_id,
|
||||
if ((select count(*) from user_group_category where ugc_user_group_ug_id = ".$_POST['groupId']." and ugc_id = ugk_category_ugc_id), ugk_category_ugc_id, null) ugk_category_ugc_id
|
||||
from user_kid main_uk
|
||||
left join user_group_kid main_ugk on ugk_user_kid_uk_id = uk_id
|
||||
where uk_id not in (
|
||||
select ugk_user_kid_uk_id from user_group_kid where ugk_user_group_ug_id = ".$_POST['groupId'].") AND uk_is_active = 1 AND uk_deleted = 0";
|
||||
}
|
||||
elseif ('members_without_category' == $_POST['searchStr']) {
|
||||
$kid_query = " SELECT
|
||||
*
|
||||
FROM
|
||||
user_kid
|
||||
JOIN
|
||||
user_group_kid ON ugk_user_kid_uk_id = uk_id
|
||||
WHERE
|
||||
ugk_user_group_ug_id = ".$_POST["groupId"]."
|
||||
AND ugk_category_ugc_id IS NULL";
|
||||
}
|
||||
elseif (is_numeric($_POST['searchStr'])) {
|
||||
# szűrés kategóriára
|
||||
$kid_query = "select uk_id, uk_name, ugk_id, ugk_user_group_ug_id, ugk_category_ugc_id from user_kid
|
||||
left join user_group_kid on ugk_user_kid_uk_id = uk_id
|
||||
where ugk_category_ugc_id = " . $_POST['searchStr'];
|
||||
}
|
||||
else {
|
||||
//keresés
|
||||
$kid_query .= " AND uk_name like '".$_POST['searchStr']."%'";
|
||||
}
|
||||
}
|
||||
|
||||
$kid_query .= " ORDER BY uk_name ASC;";
|
||||
|
||||
|
||||
$kid_assoc_array = $sql->assoc_array($kid_query);
|
||||
|
||||
|
||||
echo json_encode($kid_assoc_array);
|
||||
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
if ($_POST['parent_id'] == 'null') {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
if (empty($_GET['template_id'])) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
$filter1 = "";
|
||||
@@ -25,4 +25,4 @@ $kid_assoc_array = $sql->assoc_array($kid_query);
|
||||
|
||||
echo json_encode($kid_assoc_array);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
//ini_set('include_path', '../_class/');
|
||||
|
||||
include '../_class/class_user_parent.php';
|
||||
foreach (glob("../_class/*.php") as $filename)
|
||||
{
|
||||
//echo $filename;
|
||||
$skip = array(
|
||||
'../_class/class_user_parent.php',
|
||||
'../_class/class_Exception.php',
|
||||
);
|
||||
if (in_array($filename, $skip)) continue;
|
||||
|
||||
include $filename;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
foreach ($_POST as $key => $value) {
|
||||
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
|
||||
}
|
||||
*/
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
if (empty($_POST['uk_id'])) {
|
||||
echo json_encode(null);
|
||||
}
|
||||
|
||||
else {
|
||||
$toNotify = new user_kid();
|
||||
$toNotify->set_user_data_by_id($_POST['uk_id']);
|
||||
|
||||
if (null === $toNotify->get_uk_notify_email() || null === $toNotify->get_uk_notify_name()) {
|
||||
echo json_encode('missing-data');
|
||||
}
|
||||
else {
|
||||
$email_template_id = $sql->single_variable('select et_id from email_template where et_name = \'below_zero\'');
|
||||
if (null !== $email_template_id) {
|
||||
$emailTemplate = new email_template();
|
||||
$emailTemplate->set_et_data_by_id($email_template_id);
|
||||
|
||||
$raw_subject = $emailTemplate->get_et_subject();
|
||||
$raw_message = $emailTemplate->get_et_message();
|
||||
//var_dump($toNotify_array);
|
||||
//foreach ($toNotify_array as $toNotify) {
|
||||
$personalizedSubject = $emailTemplate->personalize($raw_subject, array(
|
||||
'uk_name' => $toNotify->get_uk_name(),
|
||||
));
|
||||
|
||||
$personalizedMessage = $emailTemplate->personalize($raw_message, array(
|
||||
'notify_name' => $toNotify->get_uk_notify_name(),
|
||||
'uk_name' => $toNotify->get_uk_name(),
|
||||
'uk_balance' => $toNotify->get_uk_balance(),
|
||||
'uk_password' => $toNotify->get_uk_password(),
|
||||
));
|
||||
|
||||
$mail = new PHPMailer(true); // Passing `true` enables exceptions
|
||||
try {
|
||||
//Server settings
|
||||
$mail->SMTPDebug = 0; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8
|
||||
$mail->Host = 'mail.gginternet.com '; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'hirlevel@tollaslabda.info'; // SMTP username
|
||||
$mail->Password = 'tollas12'; // SMTP password
|
||||
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 465; // TCP port to connect to
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name());
|
||||
$mail->addAddress($toNotify->get_uk_notify_email(), $toNotify->get_uk_notify_name());
|
||||
//$mail->addAddress('tricsusz@gmail.com', 'Tóth Richárd'); // TEST
|
||||
|
||||
|
||||
//Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $personalizedSubject;
|
||||
$mail->Body = $personalizedMessage;
|
||||
$mail->AltBody = 'Az Ön levelezője nem támogatja a HTML tartalom megjelenítését!';
|
||||
|
||||
//send mail
|
||||
$mail->send();
|
||||
//LOG SUCCESS
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$toNotify->get_uk_notify_name(),
|
||||
$toNotify->get_uk_notify_email(),
|
||||
$emailTemplate->get_et_id()
|
||||
);
|
||||
|
||||
//Update kids last noti date
|
||||
$sql->update_table('user_kid', array('uk_last_notification' => date('Y-m-d H:i:s')), array('uk_id' => $toNotify->get_uk_id()));
|
||||
|
||||
echo json_encode('success');
|
||||
|
||||
} catch (Exception $e) {
|
||||
//LOG ERROR
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$toNotify->get_uk_notify_name(),
|
||||
$toNotify->get_uk_notify_email(),
|
||||
$emailTemplate->get_et_id(),
|
||||
mysql_escape_string($e)
|
||||
);
|
||||
|
||||
echo json_encode(null);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
|
||||
//ha benne van, akkor törölni kell, egyébként insertelni
|
||||
|
||||
$ugk_query = "SELECT ugk_id FROM user_group_kid WHERE ugk_user_group_ug_id = " . $_POST['group_id']. " AND ugk_user_kid_uk_id = " . $_POST['uk_id'] . ";";
|
||||
|
||||
if ($sql->num_of_rows($ugk_query)) {
|
||||
//ha nincs category-ja, akkor töröljük, egyébként csak nullra rakjuk a group_id-t
|
||||
$ugk_id = $sql->single_variable($ugk_query);
|
||||
|
||||
$check_query = "SELECT ugk_category_ugc_id FROM user_group_kid WHERE ugk_user_group_ug_id = " . $_POST['group_id']. " AND ugk_user_kid_uk_id = " . $_POST['uk_id'] . ";";
|
||||
$category_id = $sql->single_variable($check_query);
|
||||
if ($category_id) {
|
||||
//update to null
|
||||
$sql->update_table('user_group_kid', array('ugk_user_group_ug_id' => 'null'), array('ugk_id' => $ugk_id));
|
||||
}
|
||||
else {
|
||||
$sql->execute_query("DELETE FROM user_group_kid WHERE ugk_id = " . $ugk_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
//ha még nincs benne null-lal, akkor insert, egyébként update
|
||||
$check_query = "SELECT ugk_id FROM user_group_kid WHERE ugk_user_group_ug_id IS NULL AND ugk_user_kid_uk_id = " . $_POST['uk_id'] . ";";
|
||||
$ugk_id = $sql->single_variable($check_query);
|
||||
if ($ugk_id) {
|
||||
//update
|
||||
$sql->update_table('user_group_kid', array(
|
||||
'ugk_user_group_ug_id' => $_POST['group_id']
|
||||
), array('ugk_id' => $ugk_id));
|
||||
}
|
||||
else {
|
||||
$sql->insert_into('user_group_kid', array(
|
||||
'ugk_user_kid_uk_id' => $_POST['uk_id'],
|
||||
'ugk_user_group_ug_id' => $_POST['group_id']
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -7,7 +7,7 @@ foreach ($_POST as $key => $value) {
|
||||
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
|
||||
}
|
||||
*/
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
$check_query = "SELECT * FROM presence WHERE pr_training_tr_id = " . $_POST['tr_id'] . " AND pr_user_kid_uk_id = " . $_POST['user_id'] . ";";
|
||||
|
||||
Reference in New Issue
Block a user