function delete($table, $bid, $cid, $pageid, $TotalRows) { $objResponse = new xajaxResponse(); include 'settings/config.php'; include 'settings/tables.php'; include 'settings/template.php'; require_once 'lib/modify.php'; if ($table == $tbl_blog_comments) { $comment = new ModifyEntry(); $comment->table = $tbl_blog_comments; $comment->changes = " deleted = '1' "; $comment->condition = " id = '{$cid}' "; $comment->update(); unset($comment); } $TotalRows = $TotalRows - 1; $max_pages = ceil($TotalRows / $set[0]["perpage_comments"]); if ($pageid > $max_pages) { $pageid = $pageid - 1; } $p_name = "p_num_" . $bid; $objResponse->assign($p_name, "innerHTML", $TotalRows); if ($max_pages == 0) { $p_main = "p_comments_" . $bid; $p_out = "p_page_" . $bid; $p_out2 = "p_page2_" . $bid; $objResponse->remove($p_main); $objResponse->remove($p_out); $objResponse->remove($p_out2); } else { $objResponse->loadcommands(page($table, $bid, $pageid, $TotalRows)); } return $objResponse; }
function move($direction, $table, $position, $cid) { global $tpl; $objResponse = new xajaxResponse(); /* Distinguish between up and down movement */ if ($direction == "up") { $delimiter = "<"; $order = "DESC"; //$modify1 = "position = position-1"; //$modify2 = "position = position+1"; } else { $delimiter = ">"; $order = "ASC"; //$modify1 = "position = position+1"; //$modify2 = "position = position-1"; } /***********************************/ /* Let's move */ require_once 'lib/select.php'; require_once 'lib/modify.php'; $select = new SelectEntrys(); $select->table = $table; $select->cols = 'position'; $select->condition = " position {$delimiter} '{$position}' "; if ($cid) { $select->condition .= " AND cid = '{$cid}' "; } $select->order = "position {$order}"; $select->limit = '1'; $select->module = ''; $select->template = ''; $position_less = $select->row(); $select->cols = 'id'; $position_less_id = $select->row(); $update = new ModifyEntry(); $update->table = $table; if ($position > 1 && $direction == "up" || $position_less > 0 && $direction == "down") { $update->condition = " position = '{$position}' "; if ($cid) { $update->condition .= " AND cid = '{$cid}' "; } $update->changes = " position = '{$position_less}' "; $update->update(); $update->condition = " id = '{$position_less_id}' "; if ($cid) { $update->condition .= " AND cid = '{$cid}' "; } $update->changes = " position = '{$position}' "; $update->update(); } unset($select); unset($update); /***********************************/ /* Get data in new order */ require_once 'settings/config.php'; require_once 'settings/tables.php'; require_once 'settings/template.php'; if ($table == $tbl_profile) { $profile = new SelectEntrys(); $profile->cols = 'id, german, english, value, value_EN, position'; $profile->table = $table; $profile->order = 'position'; $profile->multiSelect = '1'; $tpl->assign('array_profile', $profile->row()); unset($profile); $html = $tpl->fetch("shortprofile_content.tpl"); $objResponse->assign("layout_navi_profile", "innerHTML", $html); $html = $tpl->fetch("admin/settings_profile_fields.tpl"); $objResponse->assign("layout_set_profile", "innerHTML", $html); } if ($table == $tbl_ref) { $ref = new SelectEntrys(); $ref->cols = 'id, link, description, description_EN, position'; $ref->table = $table; $ref->order = 'position'; $ref->multiSelect = '1'; $tpl->assign('array_ref', $ref->row()); unset($ref); $html = $tpl->fetch("quicklinks_content.tpl"); $objResponse->assign("layout_navi_ref", "innerHTML", $html); $html = $tpl->fetch("admin/settings_quicklinks_fields.tpl"); $objResponse->assign("layout_set_ref", "innerHTML", $html); } if ($table == $tbl_design) { $design = new SelectEntrys(); $design->cols = 'id, german, english, hexcode, imgfolder, position'; $design->table = $table; $design->order = 'position'; $design->multiSelect = '1'; $tpl->assign('array_design', $design->row()); unset($design); $html = $tpl->fetch("set_design.tpl"); $objResponse->assign("layout_navi_design", "innerHTML", $html); $html = $tpl->fetch("admin/settings_design_fields.tpl"); $objResponse->assign("layout_set_design", "innerHTML", $html); $objResponse->includeScript("js/change_settings.js"); $objResponse->call("reload_tpl"); } if ($table == $tbl_links_c) { $links_c = new SelectEntrys(); $links_c->cols = ' id, german, english, position, visibility '; $links_c->table = $tbl_links_c; $links_c->order = "position"; $links_c->multiSelect = '1'; $array_c = $links_c->row(); unset($links_c); $tpl->assign('array_c', $array_c); $html = $tpl->fetch("admin/links_c.tpl"); $objResponse->assign("layout_links_c", "innerHTML", $html); } if ($table == $tbl_links) { $links_l = new SelectEntrys(); $links_l->cols = 'id, cid, link, description, description_EN, position, visibility'; $links_l->table = $table; $links_l->condition = "cid = '{$cid}' "; // due to performance concerns $links_l->order = 'cid, position'; $links_l->multiSelect = '1'; $array_l = $links_l->row(); foreach ($array_l as $array1 => $array2) { $array[$array2["cid"]][$array2["id"]] = array('id' => $array2["id"], 'cid' => $array2["cid"], 'link' => $array2["link"], 'description' => $array2["description"], 'description_EN' => $array2["description_EN"], 'position' => $array2["position"], 'visibility' => $array2["visibility"]); } $tpl->assign("this", $cid); $tpl->assign("array", $array); unset($links_l); $html = $tpl->fetch("admin/links_l.tpl"); $p_name = "layout_links_l_" . $cid; $objResponse->assign($p_name, "innerHTML", $html); } return $objResponse; /***********************************/ }
$links_l_edit->changes = " visibility = '0' "; $links_l_edit->update(); $count = 0; foreach ($_POST["links_l_link"] as $element) { $id = $links_l_id[$count]; if (isset($links_l_visibility["{$id}"])) { $vis = 1; } else { $vis = 0; } $links_l_edit->condition = " id = '{$links_l_id[$count]}' "; $links_l_edit->changes = " link = '{$links_l_link[$count]}', description = '{$links_l_description[$count]}', description_EN = '{$links_l_description_EN[$count]}', visibility = '{$vis}' "; $links_l_edit->update(); $count++; } unset($links_l_edit); } /******************************************/ /* design :: Delete one or more entries */ if (count($_POST["links_l_del"]) > 0) { $links_l_delete = new ModifyEntry(); $links_l_delete->table = $tbl_links; if ($_POST["links_l_del"]) { foreach ($_POST["links_l_del"] as $element) { $links_l_delete->condition = " id = '{$element}' "; $links_l_delete->delete(); } } unset($links_l_delete); } /******************************************/
$prep_trigger = new SelectEntrys(); $prep_trigger->cols = 'userID'; $prep_trigger->table = $tbl_friends; $prep_trigger->condition = " friendID = '" . $user_data['ID'] . "' "; $prep_trigger->multiSelect = '1'; $ay_trigger = $prep_trigger->row(); if ($ay_trigger !== false) { foreach ($ay_trigger as $key => $value) { $arr[] = $value['userID']; } $str_trigger = implode(",", $arr); $set_trigger = new ModifyEntry(); $set_trigger->table = $tbl_users; $set_trigger->condition = " ID IN ({$str_trigger}) "; $set_trigger->changes = " trigger_friends = 1 "; $set_trigger->update(); unset($set_trigger); } $friends_upd = new ModifyEntry(); $friends_upd->table = $tbl_friends; $friends_upd->condition = " friendID = '" . $user_data['ID'] . "' "; $friends_upd->changes = " friendID = 0 "; $friends_upd->update(); unset($friends_upd); $user_data['fb_friends'] = array(); $user_data['fb_ID'] = 0; $user_data['fb_name'] = ""; $mem_key1 = "user_data_" . $user_data['UserToken']; $memcache->replace($mem_key1, $user_data, false); //$memcache->delete('user_data_'.$user_data['ID']); //only replace header("Location:" . ROOT_DIR . "account/connectwithfriends.html?e=disconnected");
} if (!isset($_POST['opt']['4'])) { $_POST['opt']['4'] = ""; } if (!isset($_POST['opt']['5'])) { $_POST['opt']['5'] = ""; } if (!isset($_POST['opt']['6'])) { $_POST['opt']['6'] = ""; } if (!isset($_POST['opt']['7'])) { $_POST['opt']['7'] = ""; } if (!isset($_POST['opt']['8'])) { $_POST['opt']['8'] = ""; } if (!isset($_POST['opt']['9'])) { $_POST['opt']['9'] = ""; } if (!isset($_POST['opt']['10'])) { $_POST['opt']['10'] = ""; } $mysqldate = date('Y-m-d H:i:s', time()); $flash = new ModifyEntry(); $flash->table = $tbl_flashes; $flash->cols = 'userID, CreateDate, section, category, question, type, opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10'; $flash->values = " '" . $user_data['ID'] . "', '" . $mysqldate . "', '" . $_POST['section'] . "', '" . $_POST['category'] . "', '" . $_POST['question'] . "', '" . $_POST['s_type'] . "', '" . $_POST['opt']['1'] . "', '" . $_POST['opt']['2'] . "', '" . $_POST['opt']['3'] . "', '" . $_POST['opt']['4'] . "', '" . $_POST['opt']['5'] . "', '" . $_POST['opt']['6'] . "', '" . $_POST['opt']['7'] . "', '" . $_POST['opt']['8'] . "', '" . $_POST['opt']['9'] . "', '" . $_POST['opt']['10'] . "' "; $flash->insert(); unset($flash); header("Location:" . ROOT_DIR . "flash/newflash.html"); }
<?php /* Create Object :: UPDATE */ require_once './lib/modify.php'; $cms = new ModifyEntry(); /******************************************/ /* Update entry */ $msg_cms = mysql_real_escape_string($_POST[message]); $cms->table = $tbl_cms; $cms->changes = " {$cms_content} = '{$msg_cms}' "; $cms->condition = " lang = '{$lang_active}' "; $cms->update(); /******************************************/ /* Delete :: Object INSERT */ unset($cms); /******************************************/ /* Load :: Updated Main Content */ if ($cms_content == 'links') { header("Location:" . ROOT_DIR . "admin/changecms/" . $cms_content . "/"); } else { header("Location:" . ROOT_DIR . "cms/" . $cms_content . "/"); } /******************************************/
$ref_new->insert(); $positionID++; } $count++; } unset($ref_new); } /******************************************/ /* References :: Edit one or more entries */ $ref_edit = new ModifyEntry(); $ref_edit->table = $tbl_ref; $count = 0; foreach ($_POST["ref_link"] as $element) { $ref_edit->condition = " id = '{$ref_id[$count]}' "; $ref_edit->changes = " link = '{$ref_link[$count]}', description = '{$ref_description[$count]}', description_EN = '{$ref_description_EN[$count]}' "; $ref_edit->update(); $count++; } unset($ref_edit); /******************************************/ /* Quicklinks :: Delete one or more entries */ $ref_delete = new ModifyEntry(); $ref_delete->table = $tbl_ref; if ($_POST["ref_del"]) { foreach ($_POST["ref_del"] as $element) { $ref_delete->condition = " id = '{$element}' "; $ref_delete->delete(); } } unset($ref_delete); /******************************************/
<?php if (isset($submit)) { // Edit title or folder /* Create Object :: UPDATE */ require_once './lib/modify.php'; $gallery = new ModifyEntry(); /******************************************/ /* Update entry */ //date format: 0000-00-00 00:00:00 $my_time = $_POST[d_year] . '-' . $_POST[d_month] . '-' . $_POST[d_day] . ' ' . $_POST[d_hour] . ':' . $_POST[d_minute] . ':00'; $gallery->table = $tbl_gallery; $gallery->changes = " title = '{$_POST['title']}', title_EN = '{$_POST['title_EN']}', description = '{$_POST['description']}', description_EN = '{$_POST['description_EN']}', folder = '{$_POST['folder']}', date = '{$my_time}', visibility = '{$_POST['visibility']}' "; $gallery->condition = " id = '{$_POST['gid']}' "; $gallery->update(); /******************************************/ /* UPDATE :: RSS Feed */ include 'update_rss_gallery.php'; /******************************************/ /* Delete :: Object INSERT */ unset($gallery); /******************************************/ /* Load :: Updated Main Content */ $GetPage = new SelectEntrys(); $GetPage->cols = 'date'; $GetPage->table = $tbl_gallery; $GetPage->condition = " id = '{$_POST['gid']}' "; $Tdate = $GetPage->row(); unset($GetPage); $GetPage = new CheckExist(); $GetPage->tableE = $tbl_gallery;
} unset($design_new); } /******************************************/ /* design :: Edit one or more entries */ if (count($_POST["design_german"]) > 0) { $design_edit = new ModifyEntry(); $design_edit->table = $tbl_design; $count = 0; foreach ($_POST["design_german"] as $element) { $design_edit->condition = " id = '{$design_id[$count]}' "; $design_edit->changes = " german = '{$design_german[$count]}', english = '{$design_english[$count]}', hexcode = '{$design_hexcode[$count]}', imgfolder = '{$design_imgfolder[$count]}' "; $design_edit->update(); $count++; } unset($design_edit); } /******************************************/ /* design :: Delete one or more entries */ if (count($_POST["design_del"]) > 0) { $design_delete = new ModifyEntry(); $design_delete->table = $tbl_design; if ($_POST["design_del"]) { foreach ($_POST["design_del"] as $element) { $design_delete->condition = " id = '{$element}' "; $design_delete->delete(); } } unset($design_delete); } /******************************************/
<?php //TODO testing include "./lib/functions/fetch_blog.php"; require_once "./classes/facebook.php"; Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false; Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2; //TODO: create AppID for happify $config = array('appId' => '193065620755770', 'secret' => '45b3cfe7a79e293357ddb8e3424bea28'); $facebook = new Facebook($config); require_once "./classes/modify.php"; $blog = new ModifyEntry(); $blog->table = $table; $count = 0; foreach ($ay_blog as $b_items) { $url = ROOT_DIR . 'blog/' . $b_items['permalink'] . '.html'; $fquery = 'SELECT comment_count, share_count, like_count FROM link_stat WHERE url = "' . $url . '"'; $fparam = array('method' => 'fql.query', 'query' => $fquery); $fql = $facebook->api($fparam); //update database if ($fql[0]['like_count'] > $b_items['fb_likes'] || $fql[0]['comment_count'] > $b_items['fb_comments']) { $blog->changes = " fb_likes = '" . $fql[0]['like_count'] . "', fb_comments = '" . $fql[0]['comment_count'] . "' "; $blog->condition = " ID = '" . $b_items['ID'] . "' "; $blog->update(); } } unset($blog);
<?php $tpl->assign("form_title", true); $tpl->assign("form_attach", true); $tpl->assign("form_options", true); $tpl->assign("mainform.comments", 1); $tpl->assign('admin_head', $admin_head_editblog); if (isset($submit)) { /* Create Object :: INSERT */ require_once './lib/modify.php'; $blog = new ModifyEntry(); /******************************************/ /* Attachments :: Upload */ $tempname1 = $_FILES["file1"]["tmp_name"]; $filename1 = $_FILES["file1"]["name"]; $tempname2 = $_FILES["file2"]["tmp_name"]; $filename2 = $_FILES["file2"]["name"]; $tempname3 = $_FILES["file3"]["tmp_name"]; $filename3 = $_FILES["file3"]["name"]; $blog->directory = 'attachments'; if ($filename1) { $blog->tempname = $tempname1; $blog->filename = $filename1; $attachment1 = $blog->attach(); } if ($filename2) { $blog->tempname = $tempname2; $blog->filename = $filename2; $attachment2 = $blog->attach(); } if ($filename3) {
function updatedata($table, $part, $data, $id = NULL) { //global $tpl; global $memcache; global $l; global $tpl; global $user_data; global $getmonth; $objResponse = new xajaxResponse(); //include('settings/template.php'); include 'settings/tables.php'; if ($user_data == '') { require_once 'lib/functions/get_userdata.php'; } //update progress state of a goal if ($table == $tbl_goals && $part == 'progress') { require_once 'lib/functions/convert_date.php'; $goals = new ModifyEntry(); $goals->table = $table; switch ($data) { case 0: $progress = 0; break; case 1: $progress = 20; break; case 2: $progress = 40; break; case 3: $progress = 50; break; case 4: $progress = 60; break; case 5: $progress = 80; break; case 6: $progress = 100; break; } $achieved_date = date('Y-m-d H:i:s', time()); if ($progress == 100) { $goals->changes = " progress = '" . $progress . "', achieved = '" . $achieved_date . "' "; } else { $goals->changes = " progress = '" . $progress . "', achieved = '' "; } $goals->condition = " ID = '{$id}' "; $goals->update(); unset($goals); $ay_goals["progress"] = $progress; $ay_goals["achieved"] = convert_date($achieved_date, 0, $getmonth); $tpl->assign('goal', $ay_goals); $html = $tpl->fetch("modules/improve/goals/achieved.tpl"); $objResponse->assign("achieved_" . $id, "innerHTML", $html); //no refresh necessary as dropdown has latest change } elseif ($table == $tbl_goals && $part == 'update_entry') { $goals = new ModifyEntry(); $goals->table = $table; $ay_entry['entry_org'] = strip_tags($data); // $diary->changes = " entry = '".$data['edit_entry_inp']."' "; $goals->changes = " goal = '" . $ay_entry['entry_org'] . "' "; $goals->condition = " ID = '{$id}' "; $goals->update(); unset($goals); $objResponse->setReturnValue($ay_entry); } elseif ($table == $tbl_distorted_thoughts && $part == 'update_entry') { $thoughts = new ModifyEntry(); $thoughts->table = $table; $get_values = explode("%%%!", $data); $ay_entry['thought'] = strip_tags($get_values[0]); $ay_entry['response'] = strip_tags($get_values[1]); $ay_entry['action'] = strip_tags($get_values[2]); // $diary->changes = " entry = '".$data['edit_entry_inp']."' "; $thoughts->changes = " thought = '" . $ay_entry['thought'] . "', response = '" . $ay_entry['response'] . "', action = '" . $ay_entry['action'] . "' "; $thoughts->condition = " ID = '{$id}' "; $thoughts->update(); unset($thoughts); $objResponse->setReturnValue($ay_entry); } elseif ($table == $tbl_distorted_thoughts && $part == 'update_status') { $thoughts = new ModifyEntry(); $thoughts->table = $table; // $diary->changes = " entry = '".$data['edit_entry_inp']."' "; $thoughts->changes = " status = '" . $data . "' "; $thoughts->condition = " ID = '{$id}' "; $thoughts->update(); unset($thoughts); } elseif ($table == $tbl_users && $part == 'update_desc') { $update_desc = new ModifyEntry(); $update_desc->table = $table; //$desc_me = mysql_real_escape_string($data['desc_me']); $update_desc->changes = " description = '" . $data['desc_me'] . "' "; $update_desc->condition = " ID = '" . $user_data['ID'] . "' "; $update_desc->update(); unset($update_desc); //update cached user object // $mem_key1 = "user_data_".$l["token"]; $user_data['description'] = $data['desc_me']; if (mod_memcache == 1) { $memcache->replace($mem_key1, $user_data, false); } else { $_SESSION['$mem_key1'] = $user_data; } //TODO refresh view $objResponse->assign("desc_me", "innerHTML", $data['desc_me']); $objResponse->assign("inp_me", "value", $data['desc_me']); $objResponse->assign("desc_me", "style.display", "block"); if ($user_data['description'] == '') { $objResponse->assign("initial_msg", "style.display", "block"); $objResponse->assign("desc_input", "style.display", "block"); $objResponse->assign("desc_edit", "style.display", "none"); } else { $objResponse->assign("desc_edit", "style.display", "block"); $objResponse->assign("initial_msg", "style.display", "none"); $objResponse->assign("desc_input", "style.display", "none"); } } elseif ($table == $tbl_diary && $part == 'update_entry') { $diary = new ModifyEntry(); $diary->table = $table; $ay_entry['entry_org'] = strip_tags($data); // $diary->changes = " entry = '".$data['edit_entry_inp']."' "; $diary->changes = " entry = '" . $ay_entry['entry_org'] . "' "; $diary->condition = " ID = '{$id}' "; $diary->update(); unset($diary); // The Regular Expression filter $reg_exUrl = "!((?:www|http://)[^ ]+)!"; $ay_entry['entry_new_string'] = $ay_entry['entry_org']; // Check if there is a url in the text if (preg_match($reg_exUrl, $ay_entry['entry_org'], $url)) { // make the urls hyper links if (substr($url[0], 0, 3) == 'www') { $ay_entry['entry_new_string'] = preg_replace($reg_exUrl, '<a href="http://' . $url[0] . '" target="_blank">' . $url[0] . '</a>', $ay_entry['entry_org']); } else { $ay_entry['entry_new_string'] = preg_replace($reg_exUrl, '<a href="' . $url[0] . '" target="_blank">' . $url[0] . '</a>', $ay_entry['entry_org']); } } $objResponse->setReturnValue($ay_entry); } return $objResponse; }
$new_entries = count($_POST["links_c_new_english"]); $positionID = new SelectEntrys(); $positionID->cols = 'position'; $positionID->table = $tbl_links_c; $positionID->order = 'position'; $positionID->limit = '1'; $positionID = $positionID->row(); if ($positionID == 0) { $positionID = 1; } $links_c_edit = new ModifyEntry(); $links_c_edit->table = $tbl_links_c; $links_c_edit->changes = " position = position+{$new_entries} "; $links_c_edit->update(); unset($links_c_edit); $links_c_new = new ModifyEntry(); $links_c_new->table = $tbl_links_c; $links_c_new->cols = 'german, english, position, visibility'; $count = 0; foreach ($_POST["links_c_new_german"] as $element) { if ($links_c_new_german[$count] != "" && $links_c_new_english[$count] != "") { $links_c_new->values = "'{$links_c_new_german[$count]}', '{$links_c_new_english[$count]}', '{$positionID}', '0' "; $links_c_new->insert(); $positionID++; } $count++; } unset($links_c_edit); } /******************************************/ /* design :: Edit one or more entries */
function rate($site, $id, $rating) { global $memcache; global $duration; global $_COOKIE; global $tpl; include 'settings/tables.php'; $objResponse = new xajaxResponse(); if (!isset($_COOKIE["l"])) { $objResponse->redirect(ROOT_DIR); return $objResponse; } $l["token"] = substr($_COOKIE["l"], 3, -35); $mem_key1 = "user_data_" . $l["token"]; $user_data = $memcache->get($mem_key1); $mem_key2 = "trigger_f_" . $l["token"]; $trigger_f = $memcache->get($mem_key2); include 'modules/logon/get_userdata.php'; $mem_key3 = "ay_flashes_voted_" . $l["token"]; $mem_key4 = "ay_flashes_rated_" . $l["token"]; $ay_flashes_voted = $memcache->get($mem_key3); $ay_flashes_rated = $memcache->get($mem_key4); $ay_flash_cats = $memcache->get('ay_flash_cats'); include 'modules/flash/flashfeed_add.php'; if ($site == 'flash') { $likes_str = 'p_likes_' . $id; $dislikes_str = 'p_dislikes_' . $id; $rate_str = 'p_rate_' . $id; $upd_data = new ModifyEntry(); $upd_data->table = $tbl_flashes; $upd_data->condition = " ID = '{$id}' "; if ($rating == "like") { $upd_data->changes = " likes = likes+1, rating = rating+1 "; } if ($rating == "dislike") { $upd_data->changes = " dislikes = dislikes+1, rating = rating-1 "; } $upd_data->update(); unset($upd_data); $ins_data = new ModifyEntry(); $ins_data->table = $tbl_flash_ratings; $ins_data->cols = 'flashID, userID, rating'; $ins_data->values = " '{$id}', '" . $user_data['ID'] . "', '{$rating}' "; $ins_data->insert(); unset($ins_data); $flash_result = new SelectEntrys(); $flash_result->cols = 'likes, dislikes'; $flash_result->table = $tbl_flashes; $flash_result->condition = " ID = '{$id}' "; $flash_result->multiSelect = 1; $ay_flash_result = $flash_result->row(); unset($flash_result); $ay_flashes_rated[] = $id; sort($ay_flashes_rated); $mem_key4 = "ay_flashes_rated_" . $l["token"]; $memcache->replace($mem_key4, $ay_flashes_rated, false); $objResponse->assign($rate_str, "style.display", 'none'); $objResponse->assign($likes_str, "innerHTML", $ay_flash_result[0]['likes']); $objResponse->assign($dislikes_str, "innerHTML", $ay_flash_result[0]['dislikes']); } return $objResponse; }
$tpl->display('block_deactivated.tpl'); } } } else { if ($_GET[gid] && $_GET[pid]) { /* Display selected picture */ $pictureid = $_GET[pid] - 1; $picture = $pictures[$pictureid]; $destination = $dir_images . $picture; $tpl->assign('picture', $destination); $tpl->display('gallery/showpicture.tpl'); } else { if (!empty($_POST['submit_del']) && $logon_true == '1' && $str) { /* Create Object :: DELETE */ require_once './lib/modify.php'; $gallery = new ModifyEntry(); /******************************************/ /* Create Object :: SELECT */ $getfolder = new SelectEntrys(); /******************************************/ /* Create Object :: Readdirectory */ $thumbs = new readdirectory(); /******************************************/ /* Print :: SELECT */ $getfolder->cols = 'folder'; $getfolder->table = $tbl_gallery; $getfolder->condition = " id = '{$_POST['gid']}' "; $getfolder->order = ''; $getfolder->limit = "1"; $getfolder->module = ''; $getfolder->template = '';
<?php if (isset($submit)) { //set_time_limit(0); ini_set('max_execution_time', '9999999'); ini_set("memory_limit", "980M"); /* Create Object :: INSERT */ require_once './lib/modify.php'; $gallery = new ModifyEntry(); /******************************************/ /* Create new folders */ if (is_dir("gallery/{$_POST['folder']}/images") == false) { mkdir("gallery/{$_POST['folder']}/images", 0777); } if (is_dir("gallery/{$_POST['folder']}/thumbs") == false) { mkdir("gallery/{$_POST['folder']}/thumbs", 0777); } /******************************************/ /* Directorys of the images and thumbs */ $dir_images = "gallery/{$_POST['folder']}/"; $dir_images_new = "gallery/{$_POST['folder']}/images/"; $dir_thumbs = "gallery/{$_POST['folder']}/thumbs/"; /******************************************/ /* Get images in main directory */ $gallery->directory = $dir_images; $images = $gallery->listfolder('return'); /******************************************/ /* Resize images */ $gallery->dir_target = $dir_images_new; $gallery->height_max = $set[0]["height_images_max"]; $gallery->width = $set[0]["width_images"];
<?php if ($Myadmin == 1) { require_once './lib/modify.php'; if (isset($submit_blocks) || isset($submit_blocks_x)) { /* Update block on/off settings */ $blocks_edit = new ModifyEntry(); $blocks_edit->table = $tbl_blocks; $blocks_edit->changes = " status = '0' "; $blocks_edit->update(); foreach ($_POST["block_status"] as $array1 => $array2) { $blocks_edit->condition = " id = '{$array1}' "; $blocks_edit->changes = " status = '1' "; $blocks_edit->update(); } unset($blocks); $anker = "#blocks"; /******************************************/ } else { if (isset($submit_misc) || isset($submit_misc_x)) { /* Update misc entries */ $up_set = new ModifyEntry(); $up_set->table = $tbl_settings; $up_set->changes = " root_dir = '{$_POST['root_dir']}', title_hp = '{$_POST['title_hp']}', title_hp_EN = '{$_POST['title_hp_EN']}', main_title = '{$_POST['main_title']}', main_title_EN = '{$_POST['main_title_EN']}', main_description = '{$_POST['main_description']}', main_description_EN = '{$_POST['main_description_EN']}', keywords = '{$_POST['keywords']}', contact_mail = '{$_POST['contact_mail']}', perpage_blog = '{$_POST['perpage_blog']}', perpage_comments = '{$_POST['perpage_comments']}', perpage_gallery = '{$_POST['perpage_gallery']}', perpage_thumbs = '{$_POST['perpage_thumbs']}', perpage_users = '{$_POST['perpage_users']}', width_images = '{$_POST['width_images']}', height_images_max = '{$_POST['height_images_max']}', width_thumbs = '{$_POST['width_thumbs']}', height_thumbs_max = '{$_POST['height_thumbs_max']}', rss_german_url = '{$_POST['rss_german_url']}', rss_german_title = '{$_POST['rss_german_title']}', rss_english_title = '{$_POST['rss_english_title']}', rss_english_url = '{$_POST['rss_english_url']}', rss_extern_totalentries = '{$_POST['rss_extern_totalentries']}', rss_intern_totalentries = '{$_POST['rss_intern_totalentries']}', rss_msg_length = '{$_POST['rss_msg_length']}', rss_intern_left_totalentries = '{$_POST['rss_intern_left_totalentries']}', time_ban = '{$_POST['time_ban']}', del_old_visiters = '{$_POST['del_old_visiters']}', time_new_visiter = '{$_POST['time_new_visiter']}', twitter = '{$_POST['twitter']}', twitter_EN = '{$_POST['twitter_EN']}' "; if ($_POST['twitter'] != $set[0]["twitter"] || $_POST['twitter_EN'] != $set[0]["twitter_EN"]) { $up_set->changes .= ", twitter_time = '{$timestamp}' "; } $up_set->condition = " id = '1' "; $up_set->update(); $set[0]['rss_intern_totalentries'] = $_POST['rss_intern_totalentries']; $set[0]['rss_msg_length'] = $_POST['rss_msg_length'];
$profile_new->insert(); $positionID++; } $count++; } unset($profile_new); } /******************************************/ /* Profile :: Edit one or more entries */ $profile_edit = new ModifyEntry(); $profile_edit->table = $tbl_profile; $count = 0; foreach ($_POST["profile_german"] as $element) { $profile_edit->condition = " id = '{$profile_id[$count]}' "; $profile_edit->changes = " german = '{$profile_german[$count]}', english = '{$profile_english[$count]}', value = '{$profile_value[$count]}', value_EN = '{$profile_value_EN[$count]}' "; $profile_edit->update(); $count++; } unset($profile_edit); /******************************************/ /* Profile :: Delete one or more entries */ $profile_delete = new ModifyEntry(); $profile_delete->table = $tbl_profile; if ($_POST["profile_del"]) { foreach ($_POST["profile_del"] as $element) { $profile_delete->condition = " id = '{$element}' "; $profile_delete->delete(); } } unset($profile_delete); /******************************************/
<?php //delete entry if (!empty($_POST['submit_del'])) { $del_thought = new ModifyEntry(); $del_thought->table = $tbl_distorted_thoughts; $del_thought->condition = "userID = '" . $user_data['ID'] . "' && ID = '" . $_POST['id_to_delete'] . "' "; $del_thought->delete(); unset($del_thought); header("Location:" . ROOT_DIR . "improve/distorted_thoughts/index.html"); } //retrieve goal data include "./././lib/functions/fetch_thoughts.php"; //display template $tpl->assign('ay_thoughts', $ay_thoughts); if (isset($ay_thoughts[0])) { $tpl->assign('total_thoughts', count($ay_thoughts)); } else { $tpl->assign('total_thoughts', 0); }
<?php if (isset($submit)) { /* Create Object :: UPDATE */ require_once './lib/modify.php'; $blog = new ModifyEntry(); $blog->table = $tbl_blog; $blog->condition = " id = '{$_POST['id']}' "; /******************************************/ /* Attachments :: Delete */ if ($del_attach1 == 1) { $changeF = " file1 = '', filename1 = '' "; unlink("attachments/{$_POST['attach1']}"); } if ($del_attach2 == 1) { if ($changeF) { $changeF .= ","; } $changeF .= " file2 = '', filename2 = '' "; unlink("attachments/{$_POST['attach2']}"); } if ($del_attach3 == 1) { if ($changeF) { $changeF .= ","; } $changeF .= " file3 = '', filename3 = '' "; unlink("attachments/{$_POST['attach3']}"); } if ($changeF) { $blog->changes = $changeF; $blog->update();
$blog->insert(); $spam = new CheckExist(); $c_name = "ip_" . $_POST[bid]; $c_content = $_SERVER['REMOTE_ADDR']; $c_time = time() + 60 * $set[0]["time_ban"]; $spam->cookieIP($c_name, $c_content, $c_time, '/'); unset($spam); } /******************************************/ /* Load :: Updated Main Content */ header("Location:" . ROOT_DIR . $page_url); /******************************************/ } } else { /* Delete :: Old blocked IPs */ $blog = new ModifyEntry(); $blog->table = $tbl_blog_spamban; $differ = $timestamp - 60 * $set[0]['time_ban']; $blog->condition = " UNIX_TIMESTAMP(time) < {$differ} "; $blog->delete(); unset($blog); /******************************************/ /* Print :: SELECT */ $blog = new SelectEntrys(); $blog->cols = "id, author, title_DE, message_DE, title_EN, message_EN, date, DATE_FORMAT(date,'%d. %m %Y') as date_formatted, file1, filename1, file2, filename2, file3, filename3, visibility, comments"; $blog->table = $tbl_blog; if ($Myadmin == 1) { $blog->condition = "id = '{$bid}'"; } else { $blog->condition = " deleted = '0' AND visibility = '1' AND UNIX_TIMESTAMP(date) < {$timestamp} AND id = '{$bid}' "; }
function update_visiter_stats($tbl_visiter, $tbl_settings, $timestamp, $del_old_visiters, $time_new_visiter) { require_once 'lib/select.php'; require_once 'lib/modify.php'; require_once 'lib/exist.php'; $delimiter = $timestamp - $del_old_visiters * 60; // delete entries older than 2 weeks 60*60*24*14 $visiter = new ModifyEntry(); $visiter->table = $tbl_visiter; $visiter->condition = " UNIX_TIMESTAMP(date) < {$delimiter} "; $visiter->delete(); unset($visiter); $delimiter = $timestamp - $time_new_visiter * 60; $visiter = new CheckExist(); $visiter->tableE = $tbl_visiter; $visiter->conditionE = " IP = '" . $_SERVER['REMOTE_ADDR'] . "' AND UNIX_TIMESTAMP(date) >= {$delimiter} "; $visiter_exist = $visiter->exist(); unset($visiter); if ($visiter_exist == 0) { //$country = file_get_contents('http://api.hostip.info/country.php?ip='.$_SERVER['REMOTE_ADDR']); $date = date("Y-m-d H:i:s", $timestamp); $visiter = new ModifyEntry(); $visiter->table = $tbl_visiter; $visiter->cols = 'IP, date, browser, country, referer'; $visiter->values = " '" . $_SERVER['REMOTE_ADDR'] . "', '{$date}', '" . $_SERVER['HTTP_USER_AGENT'] . "', 'unknown', '" . $_SERVER['HTTP_REFERER'] . "' "; $visiter->insert(); $visiter->table = $tbl_settings; $visiter->changes = " visiters_total = visiters_total+1 "; $visiter->condition = " id = '1' "; $visiter->update(); unset($visiter); } return false; }
function insertdata($table, $data, $special = 0) { //global $tpl; global $memcache; global $l; global $tpl; global $user_data; global $getmonth; $objResponse = new xajaxResponse(); //include('settings/template.php'); include 'settings/tables.php'; if ($user_data == '' || !isset($user_data)) { require_once 'lib/functions/get_userdata.php'; } //enter new diary entry if ($table == $tbl_diary) { if ($special == 1) { $html = $tpl->fetch("modules/improve/diary/add_pin.tpl"); // $objResponse->assign("add_pin","style.className",'pin'); $objResponse->assign("add_pin", "innerHTML", $html); $objResponse->includeScript("js/pinterest.js"); $objResponse->call("m_reload"); } else { if ($data['image_file'] != '') { $objResponse->script("document.forms['insert'].submit();"); } else { $mysqldate = date('Y-m-d H:i:s', time()); $diary_note = mysql_real_escape_string(strip_tags($data['note'])); //insert new entry $diary = new ModifyEntry(); $diary->table = $table; $diary->cols = 'userID, entry, date'; $diary->values = " '" . $user_data['ID'] . "', '" . $diary_note . "', '" . $mysqldate . "' "; $diary->insert(); unset($diary); //TODO check if first entry and if yes update user array with start_month and start_year //refresh content include "lib/functions/fetch_diary.php"; $tpl->assign('ay_diary', $ay_diary); $tpl->assign('at_least_one_entry', 1); //else $tpl->assign('at_least_one_entry', 0); //TODO why is this needed now!? $tpl->assign('user_data', $user_data); $html = $tpl->fetch("modules/home/diary_entries.tpl"); $objResponse->assign("diary_entries", "innerHTML", $html); $objResponse->assign("add_pin", "innerHTML", ''); $objResponse->includeScript("js/pinterest.js"); $objResponse->call("m_reload"); } } } elseif ($table == $tbl_goals) { $mysqldate = date('Y-m-d H:i:s', time()); $note = strip_tags(mysql_real_escape_string($data['note'])); //insert new entry $goals = new ModifyEntry(); $goals->table = $table; $goals->cols = 'userID, goal, created'; $goals->values = " '" . $user_data['ID'] . "', '" . $note . "', '" . $mysqldate . "' "; $goals->insert(); unset($goals); //refresh content $html1 = $tpl->fetch("modules/improve/goals/sortfields.tpl"); $objResponse->assign("sortfields", "innerHTML", $html1); include "lib/functions/fetch_goals.php"; $tpl->assign('ay_goals', $ay_goals); $html2 = $tpl->fetch("modules/improve/goals/goal_entries.tpl"); $objResponse->assign("goal_entries", "innerHTML", $html2); $objResponse->call("reset_input"); } elseif ($table == $tbl_distorted_thoughts) { $mysqldate = date('Y-m-d H:i:s', time()); $thought = strip_tags(mysql_real_escape_string($data['thought'])); $response = strip_tags(mysql_real_escape_string($data['response'])); $c_action = strip_tags(mysql_real_escape_string($data['c_action'])); //insert new entry $thoughts = new ModifyEntry(); $thoughts->table = $table; $thoughts->cols = 'userID, thought, response, action, created'; $thoughts->values = " '" . $user_data['ID'] . "', '" . $thought . "', '" . $response . "', '" . $c_action . "', '" . $mysqldate . "' "; $thoughts->insert(); unset($thoughts); //refresh content include "lib/functions/fetch_thoughts.php"; $tpl->assign('ay_thoughts', $ay_thoughts); $html = $tpl->fetch("modules/improve/distorted_thoughts/thought_entries.tpl"); $objResponse->assign("thought_entries", "innerHTML", $html); $objResponse->call("reset_input"); } elseif ($table == $tbl_da_scale_results || $table == $tbl_bd_scale_results) { $i = 0; $dataValid = 1; $mysqldate = date('Y-m-d H:i:s', time()); //check if all items have been answered for ($i = 1; $i <= $data['items_total']; $i++) { if (!isset($data[$i])) { $objResponse->alert('Please answer all items'); // TODO put string in language file $dataValid = 0; break; } } //TODO store aggregated values in user table //all items have been answered if ($dataValid == 1) { $bd_total_score = 0; $da_total_score[0] = $da_total_score[1] = $da_total_score[2] = $da_total_score[3] = $da_total_score[4] = $da_total_score[5] = $da_total_score[6] = 0; //insert new entry $scale_data = new ModifyEntry(); $scale_data->table = $table; for ($i = 1; $i <= $data['items_total']; $i++) { if (isset($data[$i])) { $scale_data->cols = 'userID, itemID, value, date'; $scale_data->values = " '" . $user_data['ID'] . "', '" . $i . "', '" . $data[$i] . "', '" . $mysqldate . "' "; $scale_data->insert(); if ($scale_data->errno() > 0) { break; } if ($table == $tbl_da_scale_results) { switch (true) { case $i <= 5: $da_total_score[0] = $da_total_score[0] + $data[$i]; break; case $i <= 10: $da_total_score[1] = $da_total_score[1] + $data[$i]; break; case $i <= 15: $da_total_score[2] = $da_total_score[2] + $data[$i]; break; case $i <= 20: $da_total_score[3] = $da_total_score[3] + $data[$i]; break; case $i <= 25: $da_total_score[4] = $da_total_score[4] + $data[$i]; break; case $i <= 30: $da_total_score[5] = $da_total_score[5] + $data[$i]; break; case $i <= 35: $da_total_score[6] = $da_total_score[6] + $data[$i]; break; } } if ($table == $tbl_bd_scale_results) { $bd_total_score = $bd_total_score + $data[$i]; } } } unset($scale_data); $scale_data = new ModifyEntry(); $scale_data->table = $tbl_users; if ($table == $tbl_da_scale_results) { ksort($da_total_score); } if ($table == $tbl_da_scale_results) { $scale_data->changes = " da_latest_score = '" . serialize($da_total_score) . "' "; } else { $scale_data->changes = " bd_latest_score = '" . $bd_total_score . "' "; } $scale_data->condition = " ID = '" . $user_data['ID'] . "' "; $scale_data->update(); if ($scale_data->errno() > 0) { break; } if ($table == $tbl_da_scale_results) { $user_data['da_latest_score'] = serialize($da_total_score); } if ($table == $tbl_bd_scale_results) { $user_data['bd_latest_score'] = $bd_total_score; } if (mod_memcache == 1) { $memcache->replace($mem_key1, $user_data, false); } else { $_SESSION['$mem_key1'] = $user_data; } } //update cached data in memcache or session //$l["token"] = substr($_COOKIE["l"], 3, -35); if ($table == $tbl_da_scale_results) { $mem_key2 = "da_scale_data_" . $l["token"]; $mem_key2a = "da_scale_sep_strings_" . $l["token"]; $mem_key2b = "da_scale_sep_dates_" . $l["token"]; if (mod_memcache == 1) { $memcache->delete($mem_key2); $memcache->delete($mem_key2a); $memcache->delete($mem_key2b); } else { unset($_SESSION['$mem_key2']); unset($_SESSION['$mem_key2a']); unset($_SESSION['$mem_key2b']); } } if ($table == $tbl_bd_scale_results) { $mem_key3 = "bd_scale_data_" . $l["token"]; if (mod_memcache == 1) { $memcache->delete($mem_key3); } else { unset($_SESSION['$mem_key3']); } } //redirect to overview/result page if ($dataValid == 1 && $scale_data->errno() == 0 && $table == $tbl_da_scale_results) { $objResponse->redirect(ROOT_DIR . 'analyze/da_scale/index.html'); } if ($dataValid == 1 && $scale_data->errno() == 0 && $table == $tbl_bd_scale_results) { $objResponse->redirect(ROOT_DIR . 'analyze/bd_scale/index.html'); } unset($scale_data); } return $objResponse; }
$get_trigger = $usr_trigger->getUserData(); $mem_key2 = "trigger_f_" . $l["token"]; $memcache->set($mem_key2, $get_trigger, false, 300); $trigger_f = $get_trigger; } if ($user_data == "" || $trigger_f == 1) { $usr_data = new SelectEntrys(); $usr_data->token = $l["token"]; $usr_data->cols = 'ID, UserToken, UserEmail, UserPass, flash_categories_visible, fb_ID, fb_name, sections_public, language, last_online_time'; $usr_data->multiSelect = '1'; $ay_user = $usr_data->getUserData(); unset($usr_data); if ($trigger_f == 1) { $mem_key1 = "user_data_" . $l["token"]; $memcache->delete($mem_key1); $upd_data = new ModifyEntry(); $upd_data->table = $tbl_users; $upd_data->condition = " ID = '" . $ay_user[0]['ID'] . "' "; $upd_data->changes = " trigger_friends = '0' "; $upd_data->update(); unset($upd_data); } if ($ay_user[0]['fb_ID'] != 0) { $get_friends = new SelectEntrys(); $get_friends->cols = 'fb_ID, friendID, fb_name, restricted'; $get_friends->table = $tbl_friends; $get_friends->condition = " userID = '" . $ay_user[0]['ID'] . "' AND friendID > 0 "; $get_friends->order = 'fb_name'; $get_friends->multiSelect = '1'; $friends_new = $get_friends->row(); if ($friends_new !== false) {
} //print_r($upload_pic); if ($upload_pic != '') { $mysqldate = date('Y-m-d H:i:s', time()); $diary_note = mysql_real_escape_string($_POST['note']); //insert new entry $diary = new ModifyEntry(); $diary->table = $tbl_diary; $diary->cols = 'userID, entry, date, picture'; $diary->values = " '" . $user_data['ID'] . "', '" . $diary_note . "', '" . $mysqldate . "', '" . $upload_pic . "' "; $diary->insert(); unset($diary); } header("Location:" . ROOT_DIR . "improve/diary/index.html"); } elseif (!empty($_POST['submit_del'])) { $del_diary_entry = new ModifyEntry(); $del_diary_entry->table = $tbl_diary; $del_diary_entry->condition = "userID = '" . $user_data['ID'] . "' && ID = '" . $_POST['id_to_delete'] . "' "; $confirm_del = $del_diary_entry->delete(); if ($confirm_del === true && $_POST['pid'] != '') { $path = 'media/images/uploads/' . $user_data['ID'] . '/' . $_POST['pid']; $i_full = explode(".", $_POST['pid']); $path_full = 'media/images/uploads/' . $user_data['ID'] . '/' . $i_full[0] . '_full.' . $i_full[1]; unlink($path); //delete thumbnail unlink($path_full); // delete fullsize image } unset($del_diary_entry); //TODO header("Location:" . ROOT_DIR . "improve/diary/index.html");
$bd_scale_scores_ser = explode('&fscores=', $bd_scale_data); $get_latest_date = unserialize(substr($bd_scale_scores_ser[0], 7)); $latest_date = end($get_latest_date); $bd_scale_scores = unserialize($bd_scale_scores_ser[1]); $latest_key = array_keys($bd_scale_scores); $new_latest_score = ""; //only if latest entry is deleted and at least 2 entries exist we have to update the aggregated numbers if ($latest_date['date'] == $_POST['date_to_delete'] && end($latest_key) > 0) { $new_latest_score = $bd_scale_scores[end($latest_key) - 1]; } else { if (end($latest_key) == 0) { $new_latest_score = -1; } } if ($new_latest_score != "") { $scale_data = new ModifyEntry(); $scale_data->table = $tbl_users; if ($new_latest_score == -1) { $scale_data->changes = " bd_latest_score = '" . $new_latest_score . "' "; } else { $scale_data->changes = " bd_latest_score = '500' "; } $scale_data->condition = " ID = '" . $user_data['ID'] . "' "; $scale_data->update(); unset($scale_data); $user_data['bd_latest_score'] = $new_latest_score; if (mod_memcache == 1) { $memcache->replace($mem_key1, $user_data, false); } else { $_SESSION['$mem_key1'] = $user_data; }
<?php /* Goals of the user */ //delete entry if (!empty($_POST['submit_del'])) { $del_goal = new ModifyEntry(); $del_goal->table = $tbl_goals; $del_goal->condition = "userID = '" . $user_data['ID'] . "' && ID = '" . $_POST['id_to_delete'] . "' "; $del_goal->delete(); unset($del_goal); header("Location:" . ROOT_DIR . "improve/goals/index.html"); } //default sort orders $sort_goal = "ASC"; $sort_progress = "DESC"; $sort_created = "ASC"; //retrieve goal data include "./././lib/functions/fetch_goals.php"; //display template $tpl->assign('ay_goals', $ay_goals); $tpl->assign('sort_goal', $sort_goal); $tpl->assign('sort_progress', $sort_progress); $tpl->assign('sort_created', $sort_created); $tpl->assign('total_goals', $count);
<?php error_reporting(E_ALL); /* Create Object :: CONNECT */ require_once 'lib/dbCon.php'; $DBcon = new EstablishDBConnection(); $DBcon->dbserver = 'localhost'; $DBcon->dbuser = '******'; $DBcon->dbpass = '******'; $DBcon->dbname = 'usr_web231_6'; $DBcon->connectDB(); /******************************************/ //require_once("settings/dbCon.php"); require_once "lib/readdirectory.php"; require_once "lib/modify.php"; $cron = new ModifyEntry(); $cron->table = "cron"; $cron->cols = 'test'; $cron->values = " 'jo' "; $cron->insert(); unset($cron);
function registerUser($data, $action) { global $db; global $debug_mode; $objResponse = new xajaxResponse(); include 'settings/tables.php'; $reg_failure = ""; $email = trim(stripslashes(mysqli_real_escape_string($db, $data['email']))); $firstname = trim(stripslashes(mysqli_real_escape_string($db, $data['firstname']))); if ($action == 'register') { $password = trim(stripslashes(mysqli_real_escape_string($db, md5($data['password'])))); $password2 = trim(stripslashes(mysqli_real_escape_string($db, md5($data['password2'])))); $beta_code = trim(stripslashes(mysqli_real_escape_string($db, md5($data['betacode'])))); //generate activation code $act_code = md5(uniqid(rand())); $token = time() . uniqid(); //check if email is already registered $checkemail = new CheckExist(); $checkemail->tableE = $tbl_users; $checkemail->conditionE = " UserEmail = '" . $email . "' "; $CheckData = $checkemail->exist(); //error handling and validation if (!preg_match('/^([a-zA-Z0-9])+([\\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-]+)+/', $email)) { $reg_failure = "Email not valid."; } elseif (strlen($email) < 5) { $reg_failure = "Email not valid."; } elseif ($CheckData > 0) { $reg_failure = "Email already taken."; } elseif ($password != $password2) { $reg_failure = "Passwords do not match. Please correct your information and try it again."; } elseif (strlen($data['password']) < 5 || strlen($data['password2']) < 5) { $reg_failure = "Password is too short. Please correct your information and try it again."; } elseif (strlen($firstname) < 3) { $reg_failure = "Firstname is too short. Please correct your information and try it again."; } elseif ($beta_code != 'X2DH38u3z') { $reg_failure = "Beta Access Code not valid. Please correct your information and try it again."; } //registration validation successful if ($reg_failure == "") { //create new user in database $user_register = new ModifyEntry(); $user_register->table = $tbl_users; $user_register->cols = 'UserToken, UserEmail, UserPass, firstname, activation_code, language'; $user_register->values = " '{$token}', '{$email}', '{$password}', '{$firstname}', '{$act_code}', 'EN' "; $user_register->insert(); if ($user_register->errno() == 0) { //send email confirmation with activation link to user $Header = "MIME-Version: 1.0\n"; $Header .= "Content-type: text/plain; charset=utf-8\n"; $Header .= "From: noreply@happify.com"; //$from = "From: admin@wiwistud.de"; //activation.html?c=bebf08f7af79422ced07be79c2f2f5c0&t=13140575844e52ed70736d2 $act_link = ROOT_DIR . "logon/activation.html?c=" . $act_code . "&t=" . $token; $subject = "Activation link happify.com"; $message = "Activation link: " . $act_link; if ($debug_mode != "OFF") { require "../phpmailer/class.phpmailer.php"; $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP //IsSMTP(); // send via SMTP $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; $mail->SMTPDebug = 0; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $webmaster_email = "*****@*****.**"; //Reply to this email ID //$email="*****@*****.**"; // Recipients email ID //$name=$firstname; // Recipient's name //$mail->From = $webmaster_email; //$mail->FromName = "Happify"; $mail->SetFrom($webmaster_email, "Happify"); $mail->AddAddress($email, $firstname); //$mail->AddReplyTo($webmaster_email,"Webmaster"); //$mail->WordWrap = 50; // set word wrap //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment //$mail->IsHTML(true); // send as HTML $mail->Subject = $subject; $mail->Body = $message; //HTML Body $mail->AltBody = $message; //Text Body $mail->Send(); } else { mail($email, $subject, $message, $Header); } $objResponse->assign("form_reg", "style.display", 'none'); $objResponse->assign("reg_success", "style.display", 'block'); unset($user_register); } else { $objResponse->assign("p_reg_failure", "style.display", 'block'); $objResponse->assign("p_reg_failure", "innerHTML", "Registration not successful. Please try again."); // TODO move string to language file } } else { $objResponse->assign("p_reg_failure", "style.display", 'block'); $objResponse->assign("p_reg_failure", "innerHTML", $reg_failure); } } else { if ($action == 'notify') { //check if email is already registered $checkemail = new CheckExist(); $checkemail->tableE = $tbl_notify; $checkemail->conditionE = " UserEmail = '" . $email . "' "; $CheckData = $checkemail->exist(); //TODO why does it not work on server if (!preg_match('/^([a-zA-Z0-9])+([\\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-]+)+/', $email)) { $reg_failure = "Email not valid."; } // TODO move string to language file if ($CheckData > 0) { $reg_failure = "Email already registered."; } // TODO move string to language file //registration validation successful if ($reg_failure == "") { //$firstname = $data['firstname']; //create new user in database $user_register = new ModifyEntry(); $user_register->table = $tbl_notify; $user_register->cols = 'UserEmail'; $user_register->values = " '" . $email . "' "; $user_register->insert(); if ($user_register->errno() == 0) { //send email confirmation with activation link to user $Header = "MIME-Version: 1.0\n"; $Header .= "Content-type: text/plain; charset=utf-8\n"; $Header .= "From: noreply@myhappifier.info"; $subject = "myhappifier.info Launch"; $message = "Hi! \r\n\n \nThank you for your registration. We will inform you as soon as Happify launches!\r\n\r\n\n \n \nUntil then: stay happy!"; if ($debug_mode != "OFF") { require "../phpmailer/class.phpmailer.php"; $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP //IsSMTP(); // send via SMTP $mail->SMTPSecure = "ssl"; // sets the prefix to the server $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; $mail->SMTPDebug = 0; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "******"; // SMTP username $mail->Password = "******"; // SMTP password $webmaster_email = "*****@*****.**"; //Reply to this email ID //$email="*****@*****.**"; // Recipients email ID //$name=$firstname; // Recipient's name //$mail->From = $webmaster_email; //$mail->FromName = "Happify"; $mail->SetFrom($webmaster_email, "Happify"); $mail->AddAddress($email, $firstname); //$mail->AddReplyTo($webmaster_email,"Webmaster"); //$mail->WordWrap = 50; // set word wrap //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment //$mail->IsHTML(true); // send as HTML $mail->Subject = $subject; $mail->Body = $message; //HTML Body $mail->AltBody = $message; //Text Body $mail->Send(); //mail does not work } else { mail($email, $subject, $message, $Header); } $objResponse->assign("form_reg", "style.display", 'none'); $objResponse->assign("reg_success", "style.display", 'block'); unset($user_register); } else { $objResponse->assign("p_reg_failure", "style.display", 'block'); $objResponse->assign("p_reg_failure", "innerHTML", "Registration not successful. Please try again."); // TODO move string to language file } } else { $objResponse->assign("p_reg_failure", "style.display", 'block'); $objResponse->assign("p_reg_failure", "innerHTML", $reg_failure); } } } return $objResponse; }