function submitAnswerQuestion() { $id_question = $this->input->post("id_question"); $answer = $this->input->post("answer"); $questionRecord = $this->qa_m->getRecord_Question($id_question); $array['answer'] = substr($answer, 0, $GLOBALS['global']['INPUT_LIMIT']['askme_answer']); $array['id_askmeq'] = $id_question; $array['asked_by'] = $questionRecord->asked_by; $array['ans_by'] = getAccountUserId(); $array['ans_date'] = mysqlDate(); $this->mod_io_m->insert_map($array, TBL_ASK_ANSWER); //update question status $update['q_status'] = 1; $this->mod_io_m->update_map($update, array('id_askmeq' => $id_question), TBL_ASK_QUESTION); //also insert into wall feed $wall['id_parent'] = 0; $wall['id_user'] = getAccountUserId(); $wall['description'] = $array['answer']; $wall['add_date_post'] = mysqlDate(); $wall['post_id'] = 0; $wall['id_ques'] = $id_question; $id_wall = $this->mod_io_m->insert_map($wall, TBL_WALL); echo 'ok'; $this->email_sender->juzonSendEmail_JUZ_ASKME_ANSWER($array['asked_by'], $array['ans_by'], $array['answer']); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_AKSME_ANSWER); exit; }
/** * Get current loan related to this item, if one exists * * Attribute name : current_loan (NULL if item is currently not loaned) */ protected function get_current_loan($item) { $this->load->model('loan_model'); $this->load->helper('date'); $where = "item_id=" . $item->item_id . " AND " . "date<='" . mysqlDate('now') . "' AND " . "real_return_date IS NULL"; $item->current_loan = $this->loan_model->get_by($where); return $item; }
function createEventFromPost() { if (isset($_POST, $_FILES)) { return array("title" => $_POST["title"], "description" => $_POST["description"], "pub_date" => mysqlDate($_POST["pub_date"]), "event_date" => mysqlDate($_POST["event_date"]), "image_name" => $_FILES["files"]["name"][0], "image_tmp_name" => $_FILES["files"]["tmp_name"][0], "image_size" => $_FILES["files"]["size"][0], "image_type" => $_FILES["files"]["type"][0], "image_err" => $_FILES["files"]["error"][0]); } else { echo "retrieval of post data failed"; exit; } }
function submitReportAbuse() { $data['id_user'] = $this->input->post('id_user'); $data['id_reporter'] = getAccountUserId(); $data['message'] = substr($this->input->post('message'), 0, $GLOBALS['global']['INPUT_LIMIT']['askmeq']); $data['datetime'] = mysqlDate(); $this->mod_io_m->insert_map($data, TBL_REPORT_ABUSE); echo 'ok'; exit; }
function saveSearchInfo($arr) { $mypetsearch = $this->db->where('id_user', getAccountUserId())->get(TBL_PETSEARCH)->result(); $arr['id_user'] = getAccountUserId(); $arr['add_date'] = mysqlDate(); $arr['ip'] = $this->geo_lib->getIpAddress(); if ($mypetsearch) { $this->mod_io_m->update_map($arr, array('id_pet_search' => $mypetsearch[0]->id_pet_search), TBL_PETSEARCH); } else { $this->mod_io_m->insert_map($arr, TBL_PETSEARCH); } }
function updateComment() { $id_photo = $this->input->get('id_photo'); $comment = $this->input->get('comment'); $data['id_wall'] = $id_photo; $data['comment'] = $comment; $data['comment_by'] = getAccountUserId(); $data['comm_date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); $this->mod_io_m->insert_map($data, TBL_PHOTO_COMMENT); $this->email_sender->juzonSendEmail_JUZ_PHOTO_COMMENT($data['comment_by'], $id_photo, $comment); return true; }
function addToWishList() { $id_user = $this->input->get('id_user', 0); $wishlistdata = $this->seekWishListRecord($owner_id = getAccountUserId(), $id_user); if (!$wishlistdata) { $data['id_owner'] = $owner_id; $data['id_user'] = $id_user; $data['date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); $this->mod_io_m->insert_map($data, TBL_WISHLIST); } echo "<a href=\"javascript:void(0);\" onclick=\"callFuncRemoveFromWishList({$id_user});\">\r\n\t\t\t\t" . language_translate('wishlist_remove_label') . "\r\n\t\t\t</a>"; exit; }
function updpet_lock($arr) { $ownerdataobj = $this->user_io_m->init('id_user', getAccountUserId()); //$expdate=date('Y-m-d H:i:s',strtotime('+'.$arr['totday']."days")); if ($arr['totday'] > 1) { $day = "days"; } else { $day = 'day'; } $checkrecord = $this->getPetLockRecord($arr['iduser']); if (mysql_to_unix($checkrecord->lockexp_date) > mysql_to_unix(mysqlDate())) { //if this pet had locked and not expire date $sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(lockexp_date,'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user="******" AND id_owner=" . getAccountUserId(); } else { $sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(NOW(),'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user="******" AND id_owner=" . getAccountUserId(); } $this->db->query($sql); debug("update tbl pet"); //For lock history added on dt-30-12-10 $petinfo = $this->user_io_m->init('id_user', $arr['iduser']); $lock_sql = "INSERT INTO " . TBL_LOCKHISTORY . "\r\n\t\t\t\t\t(owner,pet,owner_email,pet_email,id_lock,pet_amount,owner_amount,lock_time,time_from,time_to,ip) \r\n\t\t\t\t\tVALUES('" . $ownerdataobj->username . "','" . $petinfo->username . "','" . $ownerdataobj->email . "','" . $petinfo->email . "'," . $arr['lockid'] . "," . $arr['totprice'] . "/2," . $arr['totprice'] . "/2," . $arr['totday'] . "*24,NOW(),ADDDATE(NOW(),'" . $arr['totday'] . "'),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($lock_sql); debug("update lock history"); //For lock history ended on dt-30-12-10 $user_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['user'] / 100; $site_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['site'] / 100; $sql_trans = "INSERT INTO " . TBL_TRANSACTION . " \r\n\t\t\t\t\t\t(id_user,id_owner,facevalue,amount,trans_type,site_amt,user_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t(" . $arr['iduser'] . "," . $ownerdataobj->id_user . ",0," . $arr['totprice'] . "," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . "," . $site_amount . "," . $user_amount . ",NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($sql_trans); debug("update transaction history"); //update wall $sql_wall = "INSERT INTO " . TBL_WALL . " \r\n\t\t\t(id_user,action_to,trans_type,description,post_code,add_date_post) \r\n\t\t\tVALUES\r\n\t\t\t(" . $ownerdataobj->id_user . ",'" . $arr['petname'] . "'," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . ",'with " . $arr['lockname'] . " for " . $arr['totday'] . " {$day}','" . $GLOBALS['global']['CHATTER_CODE']['pet_locked'] . "',NOW())"; $this->db->query($sql_wall); $id_wall = $this->db->insert_id(); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_LOCKPET); debug("update wall"); //update cash to pet //$ucase = $arr['totprice']/2; $sql_updu = "UPDATE " . TBL_USER . " SET cash= cash+" . $user_amount . " WHERE id_user="******"update cash pet"); //update cash to admin $sql_upda = "UPDATE " . TBL_USER . " SET cash= cash+" . $site_amount . " WHERE id_admin=1"; $this->db->query($sql_upda); debug("update cash admin"); //update cash to owner $sql_updo = "UPDATE " . TBL_USER . " SET cash=cash-" . $arr['totprice'] . " WHERE id_user="******"update cash owner"); return true; }
function getByDate($dbh, $date) { $sql = "SELECT id, title, description, pub_date, event_date," . "image_path FROM `events` WHERE pub_date=:date;"; try { $sth = $dbh->prepare($sql); $sth->bindValue(":date", mysqlDate($date)); $results = array(); $sth->execute(); } catch (PDOException $e) { echo "select by date failed: " . $e->getMessage(); } $results = $sth->fetchAll(PDO::FETCH_ASSOC); $dbh = null; return $results; }
function _cron_unlockpet() { $res = $this->db->where('lockstatus', 1)->get(TBL_PET)->result(); $unlockid = array(); for ($i = 0; $i < count($res); $i++) { if (mysql_to_unix($res[$i]->lockexp_date) < mysql_to_unix(mysqlDate())) { $unlockid[] = $res[$i]->id_pet; } } if (count($unlockid)) { for ($i = 0; $i < count($unlockid); $i++) { $sql = "UPDATE " . TBL_PET . " SET lockstatus=0,addlock_date='0000-00-00 00:00:00',userprice=0,id_petlock=0,lockexp_date='0000-00-00 00:00:00',intr=0 WHERE id_pet=" . $unlockid[$i]; $this->db->query($sql); } } }
function submitBuyPeepedAccess() { $userdataobj = getAccountUserDataObject(true); $id_user = $this->input->post('id_user', 0); $sellerdataobj = $this->user_io_m->init('id_user', $id_user); $days = $this->input->post('days', 0); $amountfee = $days * $sellerdataobj->peep_access; $cash = $userdataobj->cash; if ($cash < $amountfee) { echo json_encode(array('result' => 'ERROR', 'message' => 'Your balance is not enough to access peeped.')); exit; } if ($days < 1) { echo json_encode(array('result' => 'ERROR', 'message' => 'Unknown error.')); exit; } $data['id_buyer'] = getAccountUserId(); $data['id_user'] = $id_user; $data['amount'] = $amountfee; $data['ip'] = $this->geo_lib->getIpAddress(); $data['access_days'] = $days; $data['buy_date'] = mysqlDate(); $data['exp_date'] = sysDateTimeFormat(mysql_to_unix($data['buy_date']) + 86400 * $days, 'Y-m-d H:i:s'); $id_history = $this->mod_io_m->insert_map($data, TBL_PEEPBOUGHT_HISTORY); $site_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['site'] / 100); $user_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['user'] / 100); $transaction_data = array(); $transaction_data['id_owner'] = getAccountUserId(); $transaction_data['id_user'] = $data['id_user']; $transaction_data['amount'] = $data['amount']; $transaction_data['trans_type'] = $GLOBALS['global']['TRANS_TYPE']['buy_peeped']; $transaction_data['site_amt'] = $site_amt; $transaction_data['user_amt'] = $user_amt; $transaction_data['trans_date'] = mysqlDate(); $transaction_data['ip'] = $this->geo_lib->getIpAddress(); $transaction_id = $this->mod_io_m->insert_map($transaction_data, TBL_TRANSACTION); if ($transaction_id) { $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $site_amt . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $data['amount'] . "' WHERE id_user='******'"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $user_amt . "' WHERE id_user='******'id_user'] . "'"); } $CMCHATMSG = str_replace(array('$u1', '$u2', '$p3'), array($userdataobj->username, $sellerdataobj->username, $amountfee), language_translate('hook_chat_buy_peep_access')); echo json_encode(array('result' => 'ok', 'message' => 'Buy peeped access successfully.', 'CMCHATMSG' => $CMCHATMSG)); $this->email_sender->juzonSendEmail_JUZ_WHO_BOUGHT_WHO_PEEPED_ME($transaction_data['id_owner'], $transaction_data['id_user'], $transaction_data['amount']); exit; }
function saveAccountToSessionInfo($id_user) { $dataobj = $this->init('id_user', $id_user); $_SESSION['joz_account']['id_user'] = $id_user; $_SESSION['joz_account']['dataobj'] = $dataobj; $user['last_login'] = mysqlDate(); $this->update_map($user, $id_user); if ($dataobj) { $data['id_user'] = $dataobj->id_user; $data['ip'] = $this->geo_lib->getIpAddress(); $data['date_login'] = mysqlDate(); $data['username'] = $dataobj->username; $data['status'] = 1; $data['failure_attempt'] = 0; $data['email'] = $dataobj->email; $this->mod_io_m->insert_map($data, TBL_LOGIN); } }
function buyFavouriteAccessPackage() { $userdata = getAccountUserDataObject(true); if ($userdata->cash < $GLOBALS['global']['ADMIN_DEFAULT']['favourite']) { echo json_encode(array('result' => 'error', 'message' => "Your balance is not enough to buy this package.")); exit; } $sql = "INSERT INTO " . TBL_TRANSACTION . " (id_owner,id_user,amount,trans_type,site_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES('" . getAccountUserId() . "',1,'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "','" . $GLOBALS['global']['TRANS_TYPE']['favourite'] . "','" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($sql); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $GLOBALS['global']['ADMIN_DEFAULT']['favourite'] . "' WHERE id_user='******'"); $data['id_user'] = getAccountUserId(); $data['price'] = $GLOBALS['global']['ADMIN_DEFAULT']['favourite']; $data['datetime'] = mysqlDate(); $this->mod_io_m->insert_map($data, TBL_FAVOURITE_BUY_LOG); echo json_encode(array('result' => 'ok', 'message' => "Buy Favourite View Package successfully.")); exit; }
function sendMessage() { $gender = $this->input->post('gender'); $type = $this->input->post('type'); $message = substr($this->input->post('message'), 0, $GLOBALS['global']['INPUT_LIMIT']['random_message']); $sql = "SELECT u.id_user FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 "; $cond = ''; if ($type == 'friend') { $my_id_user = getAccountUserId(); $cond .= " AND ( (u.id_user=f.id_user AND f.friend={$my_id_user}) OR ( f.friend=u.id_user AND f.id_user={$my_id_user}) ) AND f.request_type=0 "; } if ($gender != 'Both') { $cond .= " AND u.gender= '{$gender}'"; } $offset_result = $this->db->query(" SELECT FLOOR(RAND() * COUNT(*)) AS offset FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 {$cond}")->result(); if (!$offset_result) { echo json_encode(array('result' => 'ERROR', 'message' => 'No such user found. Send failure.')); exit; } $offset = $offset_result[0]->offset; $res = $this->db->query(" SELECT u.id_user FROM " . TBL_USER . " u, " . TBL_FRIENDLIST . " f WHERE u.status=0 {$cond} LIMIT {$offset},1")->result(); if (!$res) { echo json_encode(array('result' => 'ERROR', 'message' => 'No such user found. Send failure.')); exit; } $id_user = $res[0]->id_user; $data['id_user_from'] = getAccountUserId(); $data['id_user_to'] = $id_user; $data['message'] = $message; $data['sentdate'] = mysqlDate(); if ($this->online_m->checkOnlineUser($id_user)) { //send chat message ... $data['type_message'] = 0; include_once './cometchat/cometchat_init.php'; sendMessageTo($data['id_user_to'], $data['message']); } else { //send email $data['type_message'] = 1; $this->email_sender->juzonSendEmail_RANDOMMESSAGEEMAIL($id_user, $message); } $this->mod_io_m->insert_map($data, TBL_RANDOM_MESSAGE); echo json_encode(array('result' => 'ok', 'message' => 'Send successfully.')); exit; }
function saveMapFlirtSearch($input) { $mysearch = $this->db->where('id_user', getAccountUserId())->get(TBL_MAPFLIRT_SEARCH)->result(); $arr['id_user'] = getAccountUserId(); $arr['datetime'] = mysqlDate(); $arr['gender'] = $input['gen']; $arr['age_from'] = $input['agefrom']; $arr['age_to'] = $input['ageto']; $arr['distance'] = $input['distance']; $arr['country'] = $input['country_name']; $arr['status'] = $input['status']; $arr['map'] = $input['mapvalue']; $arr['photo'] = $input['photo']; if (!$mysearch) { $this->mod_io_m->insert_map($arr, TBL_MAPFLIRT_SEARCH); } else { $this->mod_io_m->update_map($arr, array('id_mapflirt_search' => $mysearch[0]->id_mapflirt_search), TBL_MAPFLIRT_SEARCH); } }
function toggleBlockStatusMapAccess() { $user_other_id = $this->input->post('id_user'); if ($blockdata = $this->mapflirt_m->checkUserBlockedOther(getAccountUserId(), $user_other_id)) { //was blocked $this->db->where('id_blocked', $blockdata->id_blocked)->delete(TBL_BLOCKED_LIST); echo 'Block'; exit; } else { $data['id_user'] = $user_other_id; $data['blocked_user'] = getAccountUserId(); $data['blocked_type'] = $GLOBALS['global']['BLOCK_TYPE']['map']; $data['message'] = ''; $data['add_date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); $this->mod_io_m->insert_map($data, TBL_BLOCKED_LIST); echo 'Unblock'; exit; } }
function updatePetRecord($pet_uid) { //get the records for the pet $petrecord = $this->db->where('id_user', $pet_uid)->get(TBL_PET)->result(); //insert or update pet record to the current owner id if ($petrecord) { $this->db->query("UPDATE " . TBL_PET . " SET id_owner=" . getAccountUserId() . ",add_date=NOW() WHERE id_user="******"updatePetRecord with uid=" . $pet_uid); return $petdetailsarray; }
function increaseNumberChecked($id_user) { $res = $this->db->where('id_user', $id_user)->where('id_visitor', getAccountUserId())->get(TBL_CHECKED)->result(); if ($res) { $update['num_count'] = $res[0]->num_count + 1; $update['last_visit'] = mysqlDate(); $this->mod_io_m->update_map($update, array('id_checked' => $res[0]->id_checked), TBL_CHECKED); } else { $data['id_user'] = $id_user; $data['id_visitor'] = getAccountUserId(); $data['num_count'] = 1; $data['last_visit'] = mysqlDate(); $this->mod_io_m->insert_map($data, TBL_CHECKED); } }
function submit_tt_register() { $dataarr = $this->twittermodel->getCurrentUserDetails(); extract($_POST); //check valid username $usernameStatus = json_decode($this->checkUsernameValid($username)); if ($usernameStatus->result == 'ERROR') { echo json_encode(array('result' => 'ERROR', 'message' => $usernameStatus->message)); exit; } //check valid password if (strlen($password) < 6 or strlen($password) > 30) { echo json_encode(array('result' => 'ERROR', 'message' => language_translate('member_fb_password_error'))); exit; } //check valid password if (!$this->phpvalidator->is_email($email)) { echo json_encode(array('result' => 'ERROR', 'message' => language_translate('member_email_error'))); exit; } //check valid email $res = $this->db->get(TBL_USER)->result(); foreach ($res as $item) { $restrict_email[] = $item->email; } if (in_array($email, $restrict_email)) { echo json_encode(array('result' => 'ERROR', 'message' => language_translate('member_fb_email_error'))); exit; } if ($this->twittermodel->getTotalFollowers() < $GLOBALS['global']['TWITTER']['MinFollowersRequired']) { echo json_encode(array('result' => 'ERROR', 'message' => str_replace('$s', $GLOBALS['global']['TWITTER']['MinFollowersRequired'], language_translate('member_tt_followers_request_error')))); exit; } if ($this->twittermodel->getTotalTweets() < $GLOBALS['global']['TWITTER']['MinTweetsRequired']) { echo json_encode(array('result' => 'ERROR', 'message' => str_replace('$s', $GLOBALS['global']['TWITTER']['MinTweetsRequired'], language_translate('member_tt_mintweet_request_error')))); exit; } if ($this->twittermodel->accountCreatedDaysBefore() < $GLOBALS['global']['TWITTER']['MinDaysOldAccountRequired']) { echo json_encode(array('result' => 'ERROR', 'message' => str_replace('$s', $GLOBALS['global']['TWITTER']['MinDaysOldAccountRequired'], language_translate('member_tt_mindays_request_error')))); exit; } $birthday = $day . '-' . $month . '-' . $year; if (!$birthday) { echo json_encode(array('result' => 'ERROR', 'message' => language_translate('member_birthday_error'))); exit; } $dob = $this->facebookmodel->convertToJuzDateFormat(isset($birthday) ? $birthday : "10/10/2000"); $user['dob'] = $dob; $user['age'] = floor((strtotime(date('Y-m-d')) - strtotime($user['dob'])) / 31557600); //check valid age if ($user['age'] < 18) { echo json_encode(array('result' => 'ERROR', 'message' => language_translate('member_fb_age_error'))); exit; } //if not user invited, user default from config if (!isset($_SESSION['USER_INVITE'])) { $email_invite_default = $GLOBALS['global']['HOME_PAGE']['defaultinviterforhomepage']; $owner_id = $this->user_io_m->getUserIdFromEmail($email_invite_default); } else { $owner_id = $_SESSION['USER_INVITE']['id_user']; } $user['owner'] = $owner_id; $user['username'] = strtolower($username); $user['timezone'] = $timezone; $user['email'] = $email; $user['about_me'] = $dataarr['description']; $geo_data = $this->geo_lib->getLocationInfoFromIP(); if ($geo_data) { $countryData = $this->geo_lib->getCountryDataInfoFromCountryName($geo_data["country"]); if ($countryData) { $user['id_country'] = $countryData->id_country; $user['country'] = $countryData->country_name; } else { $user['id_country'] = 150; $user['country'] = 'Malaysia'; } } else { $user['id_country'] = 150; $user['country'] = 'Malaysia'; } $user['gender'] = ucfirst($gender); $user['password'] = md5($password); $user['nickname'] = $user['username']; $user['random_num'] = 0; $user['map_access'] = $GLOBALS['global']['ADMIN_DEFAULT']['map']; $user['chat_access'] = $GLOBALS['global']['ADMIN_DEFAULT']['chat']; $user['peep_access'] = $GLOBALS['global']['ADMIN_DEFAULT']['peep']; $user['announce_flag'] = $user['age']; $user['first_name'] = $firstname; $user['last_name'] = $lastname; $user['add_date'] = mysqlDate(); $user['last_login'] = mysqlDate(); if ($latitude and $longitude) { $user['longitude'] = $longitude; $user['latitude'] = $latitude; } else { $geo = $this->geo_lib->getCoordinatesFromAddress($user['country']); $user['longitude'] = $geo['longitude']; $user['latitude'] = $geo['latitude']; } //insert user data into db $new_id_user = $this->user_io_m->insert_map($user); //update invited confirm if ($new_id_user) { $confirmID = $this->user_io_m->generateConfirmInviteId($owner_id, $user['email']); $invite['invite_confirm'] = '0'; $invite['invite_join_date'] = mysqlDate(); $this->mod_io_m->update_map($invite, array('invite_confirm' => $confirmID), TBL_INVITATION); //add user to friend if have invite // $rec = $this->db->where("invited_email",$user['email'])->where("invite_id_user",$user['owner'])->get(TBL_INVITATION)->result(); // if ($rec) { $friend['id_user'] = $new_id_user; $friend['friend'] = $user['owner']; $friend['request_type'] = $GLOBALS['global']['FRIEND_ACTION']['accept']; $friend['request_date'] = mysqlDate(); //$rec[0]->invite_date; $this->mod_io_m->insert_map($friend, TBL_FRIENDLIST); // } } //update value and cash to new user $cash['cash'] = $GLOBALS['global']['USER_CASH']['invited_cash']; $cash['cur_value'] = $GLOBALS['global']['USER_CASH']['pet_start_value']; $this->user_io_m->update_map($cash, $new_id_user); //update invite cash for owner user $this->db->query("UPDATE " . TBL_USER . " SET cash=cash+" . $GLOBALS['global']['USER_CASH']['invite_cash'] . " WHERE id_user="******"INSERT INTO " . TBL_PET . " (id_user,id_owner,add_date,ip) VALUES(" . $new_id_user . "," . $owner_id . ",NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"); //Transaction for invite user $this->db->query("INSERT INTO " . TBL_TRANSACTION . " (id_owner,id_user,amount,trans_type,user_amt,trans_date,ip) \r\n\t\t\t\t\t\t\tVALUES( 1,'" . $owner_id . "','" . $GLOBALS['global']['USER_CASH']['invite_cash'] . "','" . $GLOBALS['global']['TRANS_TYPE']['referred_cash'] . "','" . $GLOBALS['global']['USER_CASH']['invite_cash'] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"); //Transaction for invited user $this->db->query("INSERT INTO " . TBL_TRANSACTION . " (id_owner,id_user,amount,trans_type,user_amt,trans_date,ip) \r\n\t\t\t\t\t\tVALUES( 1,'" . $new_id_user . "','" . $GLOBALS['global']['USER_CASH']['invited_cash'] . "','" . $GLOBALS['global']['TRANS_TYPE']['new_user_cash'] . "','" . $GLOBALS['global']['USER_CASH']['invited_cash'] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"); $FirstStatusMessage = $GLOBALS['global']['TWITTER']['FirstStatusMessage']; //$FirstStatusDescription = $GLOBALS['global']['FACEBOOK']['FirstStatusDescription']; //$FirstStatusMessage,$FirstStatusDescription, $invite_url = $this->user_io_m->getInviteUrl($user['username']); $this->twittermodel->postInviteStatus($invite_url); $this->twittermodel->registerTwitterConnected($new_id_user); // $this->facebookmodel->transferPicturesFromFaceBookToJuzon($new_id_user); $this->twittermodel->changeProfileImage($new_id_user, $this->twittermodel->savePictureToJuz($new_id_user)); //$this->twittermodel->updateAboutMeCurrentCityJuz($new_id_user); /** $friend['id_user'] = $new_id_user; $friend['friend'] = $user['owner'] ; $friend['request_type'] = $GLOBALS['global']['FRIEND_ACTION']['accept']; $friend['request_date'] = date("Y-m-d H:i:s",time()); $this->mod_io->insert_map($friend,TBL_FRIENDLIST); **/ if (checkRealEmail($email)) { $welcomeemail_status['fake_email'] = 0; } else { $welcomeemail_status['fake_email'] = 1; } $this->user_io_m->update_map($welcomeemail_status, $new_id_user); echo json_encode(array('result' => 'ok', 'message' => language_translate('member_fb_register_success'))); exit; }
function submitSnapshotWebcam() { $title = $this->input->post('title'); $myPhoto = $this->input->post('image_name'); $price = round($this->input->post('price'), 2); if (!$price or $price <= 0) { echo json_encode(array('result' => 'error', 'message' => 'Price must greater than 0.')); exit; } $webcamDir = APP_ROOT . "webcamtemp/"; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; if (!$myPhoto) { echo json_encode(array('result' => 'error', 'message' => 'Upload picture failure.')); exit; } else { copy($webcamDir . $myPhoto, $thumbnailDir . $myPhoto); copy($webcamDir . $myPhoto, $uploadDir . $myPhoto); //chmod( $thumbnailDir.$myPhoto, 0777 ); //chmod( $uploadDir.$myPhoto, 0777 ); makeThumb($myPhoto, $uploadDir, $orig_width, $orig_height); makeThumb($myPhoto, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $myPhoto; $data['id_user'] = getAccountUserId(); $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['private']; $data['price'] = $price; $data['comment'] = $title; $data['prof_flag'] = 0; $data['v_count'] = 0; $data['rate_num'] = 0; $data['rating'] = 0; $data['added_date'] = mysqlDate(); $id_photo = $this->gallery_io_m->insert_map($data); $array['id_parent'] = 0; $array['id_user'] = getAccountUserId(); $array['description'] = "priced at {$price}J\$"; $array['add_date_post'] = mysqlDate(); $array['post_name'] = getAccountUserId() . '_' . filterCharacter($title); $array['post_id'] = $id_photo; $array['post_code'] = $GLOBALS['global']['CHATTER_CODE']['backstage_photo']; $id_wall = $this->mod_io_m->insert_map($array, TBL_WALL); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_BACKSTAGE_PHOTO); $_SESSION['BACKSTAGE_PRICE'] = $price; echo json_encode(array('result' => 'ok', 'message' => 'Upload your backstage photo successfully.')); exit; } echo 'Unknown error'; exit; }
$tb_header->setTitle(array("Zeit", "Name", "Typ", "Punkte", "Bemerkung", "ADMIN")); $tb_header->setCenter(array(false, false, false, true, false)); $tb_header->setWidth(array(150, 150, 100, 100, 300, 100)); $tb_header->setSortindex($sortindex); $tb_header->setSortorder($sortorder); // TABELLE DATA $tb_table = new MyTable(); $tb_table->setHeader($tb_header); $tb_table->setTemppage(toSaferValue(@$_GET["page"]) . "&name=" . toSaferValue(@$_GET["name"])); // HISTORY if ($name == "") { $result = mysql_query("SELECT * FROM " . $databasename . "." . $tableprefix . "gbphistory ORDER BY timestamp DESC LIMIT 50"); } else { $result = mysql_query("SELECT * FROM " . $databasename . "." . $tableprefix . "gbphistory WHERE name = '" . $name . "' ORDER BY timestamp DESC"); } $types = array(); $types[1] = "<img src=\"./images/list_add.png\" alt=\"Einlagern\" title=\"Einlagern\"> Einlagern"; $types[-1] = "<img src=\"./images/list_remove.png\" alt=\"Auslagern\" title=\"Auslagern\"> Auslagern"; while ($row = @mysql_fetch_assoc($result)) { $tb_table->addRow(array($row["timestamp"], $row["name"], $row["type"], $row["points"], $row["info"], "[link]")); $tb_table->addHtmlrow(array(mysqlDate($row["timestamp"]), "<a href=\"?page=gbphistoryadmin&name=" . $row["name"] . "\">" . $row["name"] . "</a>", $types[$row["type"]], $row["points"], $row["info"], "<a href=\"index.php?page=editgbpentry&id=" . $row["historyid"] . "\">ändern</a>")); } @mysql_free_result($result); // TABELLE SORT AND PRINT $tb_table->sortTable(); $tb_table->printTable(); ?> </table> </div> </div>
function submitSnapshotWebcam() { $title = $this->input->post('title'); $myPhoto = $this->input->post('image_name'); $webcamDir = APP_ROOT . "webcamtemp/"; $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/"; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/"; $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height']; $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width']; $orig_width = $GLOBALS['global']['IMAGE']['orig_width']; $orig_height = $GLOBALS['global']['IMAGE']['orig_height']; if (!$myPhoto) { echo "Upload picture failure."; exit; } else { copy($webcamDir . $myPhoto, $thumbnailDir . $myPhoto); copy($webcamDir . $myPhoto, $uploadDir . $myPhoto); //chmod( $thumbnailDir.$myPhoto, 0777 ); //chmod( $uploadDir.$myPhoto, 0777 ); makeThumb($myPhoto, $uploadDir, $orig_width, $orig_height); makeThumb($myPhoto, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $myPhoto; $data['id_user'] = getAccountUserId(); $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['public']; $data['price'] = 0; $data['comment'] = $title; $data['prof_flag'] = 0; $data['v_count'] = 0; $data['rate_num'] = 0; $data['rating'] = 0; $data['added_date'] = mysqlDate(); $this->gallery_io_m->insert_map($data); echo json_encode(array('result' => 'ok', 'message' => 'Upload your snapshot successfully.')); exit; } echo 'Unknown error'; exit; }
function juzTimeDisplay($mysql_time) { if (!getAccountUserId()) { $timestamp = mysql_to_unix($mysql_time); return sysDateTimeFormat($timestamp, JUZDATETIMEFM); } else { $userdataobj = getAccountUserDataObject(true); $timestamp = mysql_to_unix($mysql_time); $gmtamount = time() - mysql_to_unix(mysqlDate()); $gmtconvert = $timestamp + $gmtamount; $localtime = $gmtconvert + parseGMTtime($userdataobj->timezone); return sysDateTimeFormat($localtime, JUZDATETIMEFM); } }
function submitExtendAccessMapFlirts() { $userdataobj = getAccountUserDataObject(true); $id_user = $this->input->post('id_user', 0); $sellerdataobj = $this->user_io_m->init('id_user', $id_user); $days = $this->input->post('days', 0); $amountfee = $days * $sellerdataobj->map_access; $cash = $userdataobj->cash; if ($cash < $amountfee) { echo json_encode(array('result' => 'ERROR', 'message' => 'Your balance is not enough to access map flirts.')); exit; } if ($days < 1) { echo json_encode(array('result' => 'ERROR', 'message' => 'Unknown error.')); exit; } if ($this->mapflirt_m->checkUserBlockedOther($id_user, getAccountUserId())) { echo json_encode(array('result' => 'ERROR', 'message' => 'Error. This user was blocked you from access map location.')); exit; } $historydata = $this->mapflirt_m->getHistory($id_user); if ($historydata) { $data['id_buyer'] = getAccountUserId(); $data['id_seller'] = $id_user; $data['amount'] = $amountfee; $data['ip'] = $this->geo_lib->getIpAddress(); if (mysql_to_unix($historydata->exp_date) > mysql_to_unix(mysqlDate())) { // extend $data['buy_date'] = $historydata->buy_date; $data['exp_date'] = sysDateTimeFormat(mysql_to_unix($historydata->exp_date) + 86400 * $days, 'Y-m-d H:i:s'); $data['map_days'] = $days + (int) (mysql_to_unix($historydata->exp_date) / 86400); } else { //re-buy $data['buy_date'] = mysqlDate(); $data['exp_date'] = sysDateTimeFormat(mysql_to_unix($data['buy_date']) + 86400 * $days, 'Y-m-d H:i:s'); $data['map_days'] = $days; } $id_history = $this->mod_io_m->update_map($data, array('id_map_history' => $historydata->id_map_history), TBL_MAP_HISTORY); $site_amt = $amountfee * ($GLOBALS['global']['MAP_PRICE']['site'] / 100); $user_amt = $amountfee * ($GLOBALS['global']['MAP_PRICE']['user'] / 100); $transaction_data = array(); $transaction_data['id_owner'] = getAccountUserId(); $transaction_data['id_user'] = $data['id_seller']; $transaction_data['amount'] = $data['amount']; $transaction_data['trans_type'] = $GLOBALS['global']['TRANS_TYPE']['map']; $transaction_data['site_amt'] = $site_amt; $transaction_data['user_amt'] = $user_amt; $transaction_data['trans_date'] = mysqlDate(); $transaction_data['ip'] = $this->geo_lib->getIpAddress(); $transaction_id = $this->mod_io_m->insert_map($transaction_data, TBL_TRANSACTION); if ($transaction_id) { $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $site_amt . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $data['amount'] . "' WHERE id_user='******'"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $user_amt . "' WHERE id_user='******'id_seller'] . "'"); } debug("extend/buy map location transaction id={$transaction_id} "); $this->email_sender->juzonSendEmail_JUZ_WHO_BOUGHT_MY_MAPFLIRTS($transaction_data['id_owner'], $transaction_data['id_user'], $transaction_data['amount']); } else { $i = 0; if (!$this->mapflirt_m->wasIMapedUser($id_user)) { $sellerdataobj = $this->user_io_m->init('id_user', $id_user); $data[$i]['id_buyer'] = getAccountUserId(); $data[$i]['id_seller'] = $id_user; $data[$i]['amount'] = $sellerdataobj->map_access; $data[$i]['map_days'] = 1; $data[$i]['buy_date'] = mysqlDate(); $data[$i]['exp_date'] = sysDateTimeFormat(mysql_to_unix($data[$i]['buy_date']) + 86400, 'Y-m-d H:i:s'); $data[$i]['ip'] = $this->geo_lib->getIpAddress(); foreach ($data as $key => $value) { $id_history = $this->mod_io_m->insert_map($value, TBL_MAP_HISTORY); $site_amt = $value['amount'] * ($GLOBALS['global']['MAP_PRICE']['site'] / 100); $user_amt = $value['amount'] * ($GLOBALS['global']['MAP_PRICE']['user'] / 100); $transaction_data = array(); $transaction_data['id_owner'] = getAccountUserId(); $transaction_data['id_user'] = $value['id_seller']; $transaction_data['amount'] = $value['amount']; $transaction_data['trans_type'] = $GLOBALS['global']['TRANS_TYPE']['map']; $transaction_data['site_amt'] = $site_amt; $transaction_data['user_amt'] = $user_amt; $transaction_data['trans_date'] = mysqlDate(); $transaction_data['ip'] = $this->geo_lib->getIpAddress(); $transaction_id = $this->mod_io_m->insert_map($transaction_data, TBL_TRANSACTION); if ($transaction_id) { $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $site_amt . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $value['amount'] . "' WHERE id_user='******'"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $user_amt . "' WHERE id_user='******'id_seller'] . "'"); } debug("extend/buy map location transaction id={$transaction_id} "); $this->email_sender->juzonSendEmail_JUZ_WHO_BOUGHT_MY_MAPFLIRTS($transaction_data['id_owner'], $transaction_data['id_user'], $transaction_data['amount']); } } } $context = $this->input->post('context'); if ($context == 'CMCHAT') { $CMCHAT = str_replace(array('$u1', '$u2', '$p3'), array($userdataobj->username, $sellerdataobj->username, $amountfee), language_translate('hook_chat_buy_map')); } else { $CMCHAT = ''; } echo json_encode(array('result' => 'ok', 'message' => 'Buy successfully.', 'CMCHATMSG' => $CMCHAT)); exit; }
<?php require_once 'template/header.php'; require_once 'template/navigation.php'; if (isset($_POST['createproject']) && UserCan('create_project')) { $projectname = mysqli_real_escape_string($con, $_POST['projectname']); $userid = mysqli_real_escape_string($con, $_POST['userid']); if (empty($userid)) { $userid = $_SESSION['userid']; } $projectsummary = mysqli_real_escape_string($con, $_POST['projectsummary']); $projectdetails = mysqli_real_escape_string($con, $_POST['projectdetails']); $startdate = mysqli_real_escape_string($con, $_POST['startdate']); $enddate = mysqli_real_escape_string($con, $_POST['enddate']); $sql = "INSERT INTO `{$db_data}`.`projects` (`projectid` , `userid`, `projectname` , `projectsummary` , `projectdetails` , `creationdate` , `startdate` , `enddate`)\n VALUES (NULL , '" . $userid . "','" . $_POST['projectname'] . "', '" . $_POST['projectsummary'] . "', '" . $_POST['projectdetails'] . "',CURRENT_TIMESTAMP , '" . mysqlDate($startdate) . "', '" . mysqlDate($enddate) . "');"; if (!mysqli_query($con, $sql)) { die("Error"); } } ?> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <?php breadcrumbs(""); ?> <h1 class="page-header"><?php echo $message['projects']; ?> </h1> <ul class="nav nav-tabs"> <li class="active"><a href="#projects" data-toggle="tab"><?php echo $message['projects'];
function rateHentai($id_video, $score) { $videodata = $this->mod_io_m->init('id_video', $id_video, TBL_VIDEO); $data['rate_by'] = getAccountUserId(); $data['rate_to'] = 1; $data['id_whom'] = $id_video; $data['rate_type'] = $GLOBALS['global']['RATING']['hentai']; $data['rate'] = $score; $data['rate_date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); $this->mod_io_m->insert_map($data, TBL_RATE); //update image rating record $rateArr = $this->getRateObject($id_video, $data['rate_type'], $data['rate_to']); $update['rate_num'] = $rateArr['rate_num']; $update['rating'] = $rateArr['rating']; $this->mod_io_m->update_map($update, array('id_video' => $id_video), TBL_VIDEO); //insert to wall $array['id_parent'] = 0; $array['id_user'] = getAccountUserId(); $array['description'] = slugify($videodata->name); $array['add_date_post'] = mysqlDate(); $array['post_name'] = $score . '_' . filterCharacter($videodata->name); $array['post_id'] = $id_video; $array['post_code'] = $GLOBALS['global']['CHATTER_CODE']['rating_hentai']; $array['rate_num'] = $rateArr['rate_num']; $array['rating'] = $rateArr['rating']; $id_wall = $this->mod_io_m->insert_map($array, TBL_WALL); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_RATE_VIDEO); }
function inviteFriend() { $userdataobj = getAccountUserDataObject(); $message = $this->input->get("message", ""); $subject = $this->input->get("subject", ""); $emailaddress = $this->input->get("emailaddress", ""); $invite_url = "<a href='" . $this->user_io_m->getInviteUrl($userdataobj->username) . "'>" . $this->user_io_m->getInviteUrl($userdataobj->username) . "</a>"; $message = str_replace('{$invite_url}', $invite_url, nl2p2($message)); $message .= str_replace('{$invite_url}', $this->user_io_m->getInviteUrl($userdataobj->username), language_translate('append_invite_friend')); $message = strip_slashes($message); $emailArr = $notEmailArr = array(); $emailepl = explode(',', $emailaddress); foreach ($emailepl as $email) { $tmp = trim($email); if ($this->phpvalidator->is_email($tmp)) { $emailArr[] = $tmp; } else { $notEmailArr[] = $tmp; } } //$invite_link = $this->user_io_m->getInviteUrl($userdataobj->username); $userdataExisted = array(); $i = 0; foreach ($emailArr as $email) { $checkuserdata = $this->mod_io_m->init('email', $email, TBL_USER); if ($checkuserdata) { $userdataExisted[] = $checkuserdata; } else { $i++; $this->email_sender->setSubject($subject); $this->email_sender->setFromEmail($userdataobj->email); $this->email_sender->setToEmail($email); $inviteID = $this->user_io_m->generateConfirmInviteId($userdataobj->id_user, $email); $check = $this->mod_io_m->init('invite_confirm', $inviteID, TBL_INVITATION); if (!$check) { $insert['invite_email'] = $userdataobj->email; $insert['invite_id_user'] = $userdataobj->id_user; $insert['invited_email'] = $email; $insert['invite_msg'] = $message; $insert['invite_confirm'] = $inviteID; $insert['invite_date'] = mysqlDate(); $this->mod_io_m->insert_map($insert, TBL_INVITATION); } else { $update['invite_msg'] = $message; $update['invite_date'] = mysqlDate(); $this->mod_io_m->update_map($update, array('invite_confirm' => $inviteID), TBL_INVITATION); } /* $body = $this->load->view('member/email_templates/friend/invite_friend', array('invite_link'=>$invite_link,'userdataobj'=>$userdataobj,'message'=>$message), true ); */ $this->email_sender->setBody($message); $this->email_sender->sendEmail(); } } $msg = "Sent email successfully: " . $i; $msg .= "<br/> Failure: " . count($notEmailArr); $msg .= "<br/><div class='clear'></div>"; if (count($userdataExisted) != 0) { $msg .= "<br/>These users were existed in system:<br/><div class='clear'></div>"; foreach ($userdataExisted as $item) { $msg .= "<div class=\"wrap-left\" style=\"width:100px;\"><div class=\"user-profile-owner\">"; $msg .= "<img src='" . $this->user_m->getProfileAvatar($item->id_user) . "' /><br/>"; $msg .= "" . $this->user_m->getProfileDisplayName($item->id_user) . "</div></div>"; $msg .= "<div class=\"wrap-right\"><div class=\"user-profile-owner\">"; $msg .= "<b>Email:</b> " . $item->email; $msg .= "</div></div><div class='clear'></div><hr/>"; } } echo $msg; exit; }
function toDbFB() { $data = new Spreadsheet_Excel_Reader("./media/fb.xls"); $rowNumber = $data->rowcount($sheet_index = 0); $colNumber = $data->colcount($sheet_index = 0); $valueArray = array(); $j = 0; for ($i = 0; $i <= $rowNumber; $i++) { if ($id = $data->val($i, 2, $sheet = 0) and $this->phpvalidator->is_url($data->val($i, 6, $sheet = 0))) { $j += 1; $valueArray[$j]['ID'][] = $id; } if ($seriesName = $data->val($i, 3, $sheet = 0) and $this->phpvalidator->is_url($data->val($i, 6, $sheet = 0))) { $valueArray[$j]['seriesName'][] = $seriesName; } if ($seriesThumb = $data->val($i, 4, $sheet = 0) and $this->phpvalidator->is_url($data->val($i, 6, $sheet = 0))) { $valueArray[$j]['seriesThumb'][] = $seriesThumb; } if ($episodeName = $data->val($i, 5, $sheet = 0) and $this->phpvalidator->is_url($data->val($i, 6, $sheet = 0))) { $valueArray[$j]['episodeName'][] = $episodeName; } if ($link = $data->val($i, 6, $sheet = 0) and $this->phpvalidator->is_url($data->val($i, 6, $sheet = 0))) { $valueArray[$j]['link'][] = $link; } } //var_dump($valueArray); foreach ($valueArray as $key => $array) { $seriesName = $array['seriesName'][0]; $seriesdata = array(); $seriesdata['id_hentai_category'] = 1; $seriesdata['code_series'] = NULL; $seriesdata['name'] = $seriesName; $seriesdata['image'] = NULL; //strtolower( str_replace(array(' ','-','_'), array('-','-','-'), $seriesName) ); $seriesdata['img_url'] = $array['seriesThumb'][0]; //$this->getThumbnail($array['link'][0]); $seriesdata['add_date'] = mysqlDate(); $seriesdata['last_update'] = mysqlDate(); $seriesdata['ip'] = $this->geo_lib->getIpAddress(); $id_series = $this->mod_io_m->insert_map($seriesdata, TBL_SERIES); for ($i = 0; $i < count($array['episodeName']); $i++) { $episodeName = $array['episodeName'][$i]; $link = $array['link'][$i]; $episodedata = array(); $episodedata['id_series'] = $id_series; $episodedata['code_video'] = strtolower(str_replace(array(' ', '-', '_'), array('', '', ''), $episodeName)); $episodedata['name'] = $episodeName; $episodedata['video_url'] = $link; $episodedata['img_url'] = $this->getThumbnail($link); $episodedata['description'] = NULL; $episodedata['rating'] = 0; $episodedata['rate_num'] = 0; $episodedata['view_count'] = 0; $episodedata['add_date'] = mysqlDate(); $episodedata['last_update'] = mysqlDate(); $episodedata['ip'] = $this->geo_lib->getIpAddress(); $this->mod_io_m->insert_map($episodedata, TBL_VIDEO); } } }
function saveCategory() { $id_category = intval($this->input->post('id_category')); $data['cat_name'] = $this->input->post('cat_name'); $data['status'] = $this->input->post('status'); $data['code_category'] = slugify($data['cat_name']); $data['add_date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); if ($id_category) { $this->mod_io_m->update_map($data, array('id_category' => $id_category), TBL_CATEGORY); } else { $this->mod_io_m->insert_map($data, TBL_CATEGORY); } echo 'ok'; $this->session->set_flashdata('success', lang('templates.tmpl_save_success')); exit; }
function savePetLock() { $id_petlock = intval($this->input->post('id_petlock', 0)); $lockdata = $this->mod_io_m->init('id_petlock', $id_petlock, TBL_PETLOCK); if ($lockdata) { $image = $lockdata->image; } else { $image = ''; } $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig']; $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb']; $thumb_height = 60; $thumb_width = 60; if (isset($_FILES["image"]) and !empty($_FILES["image"]['name'])) { if ($_FILES["image"]['size'] / 1000000 > allowMaxFileSize()) { $image = ''; } else { $image = $this->module_helper->uploadFile($_FILES["image"]['tmp_name'], $_FILES["image"]['name'], $uploadDir, allowExtensionPictureUpload()); } } if (!$image) { echo 'Image must not empty'; exit; } else { copy($uploadDir . $image, $thumbnailDir . $image); makeThumb($image, $thumbnailDir, $thumb_width, $thumb_height); $data['image'] = $image; } if (!$this->phpvalidator->is_numeric($this->input->post('price'))) { echo 'Price must be numeric.'; exit; } else { $data['price'] = $this->input->post('price'); } if (!$this->phpvalidator->is_numeric($this->input->post('chargeperday'))) { echo 'Charge per day must be numeric.'; exit; } else { $data['chargeperday'] = $this->input->post('chargeperday'); } if ($this->input->post('name')) { $data['name'] = $this->input->post('name'); $data['code_lock'] = slugify($this->input->post('name')); } $data['add_date'] = mysqlDate(); $data['ip'] = $this->geo_lib->getIpAddress(); if ($lockdata) { $this->mod_io_m->update_map($data, array('id_petlock' => $id_petlock), TBL_PETLOCK); } else { $this->mod_io_m->insert_map($data, TBL_PETLOCK); } echo 'ok'; $this->session->set_flashdata('success', lang('templates.tmpl_save_success')); exit; }