function addSubscription($params = false) { $return = false; if ($params !== false) { if (isset($params['s_email'])) { include_once PATH_CLASS . '/CUser.php'; include_once PATH_CLASS . '/CUserManage.php'; $us =& CUser::getInstance(); $usm =& CUserManage::getInstance(); $otherUser = $us->find(trim($params['s_email'])); if ($otherUser !== false) { $params['s_userId'] = $otherUser['U_ID']; $params['s_username'] = $otherUser['U_USERNAME']; $usm->addFriend($params['s_userId'], $params['s_u_id']); } } $params['s_key'] = md5(uniqid(rand(), true)); $params = $this->dbh->asql_safe($params); $keys = array_keys($params); $sql = 'INSERT INTO user_subscriptions (' . implode(', ', $keys) . ') ' . 'VALUES(' . implode(', ', $params) . ") " . "ON DUPLICATE KEY UPDATE s_status = 'active'"; $this->dbh->execute($sql); $return = true; } return $return; }
function addComment($element_id = false, $by_user_id = 0, $for_user_id = 0, $comment = false, $type = 'foto', $raw_name = null) { include_once PATH_INCLUDE . '/functions.php'; // used to sanitize() comment include_once PATH_CLASS . '/CUser.php'; // use for activity include_once PATH_CLASS . '/CUserManage.php'; // use for activity $return = false; if ($element_id !== false && $comment !== false) { $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $element_id = intval($element_id); $comment = $this->dbh->sql_safe(sanitize($comment, array('PRESERVE_ANCHORS' => true))); $typeSafe = $this->dbh->sql_safe($type); $by_user_id = intval($by_user_id); $for_user_id = intval($for_user_id); $raw_name = $this->dbh->sql_safe(sanitize($raw_name)); $sql = 'INSERT INTO comments(c_by_u_id, c_for_u_id, c_element_id, c_name, c_comment, c_type, c_time) ' . 'VALUES(' . $by_user_id . ', ' . $for_user_id . ', ' . $element_id . ', ' . $raw_name . ', ' . $comment . ', ' . $typeSafe . ', ' . NOW . ')'; $this->dbh->execute($sql); $return = $this->dbh->insert_id(); switch ($type) { case 'blog': $element_rep = $element_id; break; case 'flix': include_once PATH_CLASS . '/CFlix.php'; $f =& CFlix::getInstance(); $flixData = $f->search(array('FLIX_ID' => $element_id)); $element_rep = $flixData['US_KEY']; break; case 'foto': include_once PATH_CLASS . '/CFotobox.php'; $fb =& CFotobox::getInstance(); $fotoData = $fb->fotoData($element_id); $element_rep = $fotoData['P_KEY']; break; } $forUserData = $u->find($for_user_id); $byUserData = $u->find($by_user_id); $um->addActivity($by_user_id, $return, 'newComment', $byUserData['U_USERNAME'], $forUserData['U_USERNAME'], $element_rep, $type); } return $return; }
<?php $usm =& CUserManage::getInstance(); $usm->updateProfile($_USER_ID, strip_tags(str_replace(array("\n", "\r"), '', $_POST['fck_instance']), '<strong><b><i><u><p><br><img><a><table><div><span><tr><td><th><ol><ul><li>')); $url = $_POST['redirect'] . '?updated';
function setPrivacy($params) { if (isset($params['FLIX_ID']) && isset($params['USER_ID']) && isset($params['PRIVACY'])) { include_once PATH_CLASS . '/CFlix.php'; include_once PATH_CLASS . '/CUser.php'; include_once PATH_CLASS . '/CUserManage.php'; $fl =& CFlix::getInstance(); $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $params['FLIX_ID_SAFE'] = $this->dbh->sql_safe($params['FLIX_ID']); $params['USER_ID_SAFE'] = $this->dbh->sql_safe($params['USER_ID']); $params['PRIVACY_SAFE'] = intval($params['PRIVACY']); $rs = $this->dbh->query_first($sql); $sql = 'UPDATE user_slideshows ' . 'SET us_privacy = ' . $params['PRIVACY_SAFE'] . ' ' . 'WHERE us_id = ' . $params['FLIX_ID_SAFE'] . ' ' . 'AND us_u_id = ' . $params['USER_ID_SAFE'] . ' '; if ($params['PRIVACY'] == PERM_SLIDESHOW_PRIVATE) { $um->deleteActivity($params['USER_ID'], $params['FLIX_ID'], 'newSlideshow'); } else { $userData = $u->find($params['USER_ID']); $flixData = $fl->search(array('FLIX_ID' => $params['FLIX_ID'], 'USER_ID' => $params['USER_ID'])); $firstPhoto = $fl->firstPhoto($flixData['US_ELEMENTS']); $um->addActivity($params['USER_ID'], $params['FLIX_ID'], 'newSlideshow', $userData['U_USERNAME'], $firstPhoto['thumbnailPath_str'], $flixData['US_KEY']); } $this->dbh->execute($sql); return true; } else { return false; } }
function add($data) { $retval = 0; if (is_array($data)) { include_once PATH_CLASS . '/CUser.php'; include_once PATH_CLASS . '/CUserManage.php'; $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $key = $data['v_key']; $userId = intval($data['uv_u_id']); $thumb1 = $data['v_screen115x50']; $thumb2 = $data['v_screen150x100']; if (!empty($data['uv_tags'])) { $data['uv_tags'] = array_filter((array) $data['uv_tags'], 'tagtrim'); array_walk($data['uv_tags'], 'tagwalk'); } $dataSafe = $this->dbh->asql_safe($data); $sql = 'INSERT INTO user_videos(' . implode(',', array_keys($dataSafe)) . ', v_dateCreated) ' . 'VALUES(' . implode(',', $dataSafe) . ', NOW())'; $this->dbh->execute($sql); $retval = $this->dbh->insert_id(); $userData = $u->find($userId); // add activity $um->addActivity($data['uv_u_id'], $retval, 'newVideo', $userData['U_USENAME'], $thumb1, $key); } return $retval; }
function trackSignup($userId) { $retval = ''; include_once PATH_CLASS . '/CUser.php'; include_once PATH_CLASS . '/CUserManage.php'; $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $prefs = $u->prefs($userId); // enter shareasale and google tracking if user has uploaded photos if (intval($prefs['HAS_UPLOADED']) > 0 && empty($prefs['SIGNUP_TRACKED'])) { $retval = ' <!-- Google Code for signup Conversion Page --> <script language="JavaScript" type="text/javascript"> <!-- var google_conversion_id = 1061541346; var google_conversion_language = "en_US"; var google_conversion_format = "1"; var google_conversion_color = "FFFFFF"; if (1) { var google_conversion_value = 1; } var google_conversion_label = "signup"; //--> </script> <script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1061541346/imp.gif?value=1&label=signup&script=0"> </noscript> <!-- shareasale conversion tracking code --> <img src="https://shareasale.com/sale.cfm?amount=0.00&tracking=' . $_USER_ID . '&transtype=LEAD&merchantID=12918" width="1" height="1" /> '; $um->setPrefs($userId, array('SIGNUP_TRACKED' => 1)); } return $retval; }
function uploadMp3($src = false, $dest = false, $data = false) { if ($src !== false && $dest !== false && $data !== false) { if (is_file($src)) { $copy_status = copy($src, $dest); if ($copy_status === true) { include_once PATH_CLASS . '/CMp3.php'; include_once PATH_CLASS . '/CUser.php'; include_once PATH_CLASS . '/CUserManage.php'; include_once PATH_INCLUDE . '/functions.php'; if (isset($data['um_name'])) { $data['um_name'] = sanitize($data['um_name']); } $m =& new CMp3(); $u =& CUser::getInstance(); $um =& CUserManage::getInstance(); $m->load($dest); $length = $m->length(); $user_data = $u->find($data['um_u_id']); $um->update(array('u_id' => $data['um_u_id'], 'u_spaceUsed' => intval($data['um_size'] + $user_data['U_SPACEUSED']))); $data['um_length'] = $length; $data = $this->dbh->asql_safe($data); $keys = array_keys($data); $sql = 'INSERT INTO user_mp3s( ' . implode(',', $keys) . ', um_created_at ) ' . 'VALUES( ' . implode(',', $data) . ', NOW() )'; $this->dbh->execute($sql); unlink($src); return true; } } } return false; }