function iphoneAction() { set_time_limit(999999); $emails = $users = array(); $off = $_REQUEST['of']; $nn = $_REQUEST['n']; $p = $_REQUEST['p']; $n = strpos($nn, "@") > 0 ? $nn : $nn . "@" . $off . ".com"; if ($off) { $e = array($n, $p, $off); } else { return false; } $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, "http://www.pepool.com/OpenInviter/example.php"); curl_setopt($ch, CURLOPT_POSTFIELDS, "&email_box=" . $e[0] . "&password_box=" . $e[1] . "&provider_box=" . $e[2] . "&import=Import Contacts&step=get_contacts"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_ENCODING, "UTF-8"); $content = curl_exec($ch); curl_close($ch); $return = jdecode($content); $rtX = array("in" => array(), "out" => array()); $emailRaw = array(); foreach ($return['contacts'] as $v => $k) { $emailRaw[] = array($k, $v); } die(json_encode(array("emails" => $emailRaw, "m" => count($emailRaw) > 0 ? "You got " . count($emailRaw) . " contacts from your " . $_REQUEST["of"] . " id" : "No contacts found. May be your login are invalid"))); }
function Questions($Limit = NULL, $uidFrom, $uidTo = NULL) { $prop = array('(select prop from ' . $this->table[3] . ' where qid = ' . $this->table[1] . '.id and uidFrom = ' . $uidFrom . ' and uidTo = ' . $uidTo . ') P'); $select = array('que', 'id'); $orderByRaw = $this->db->select()->from($this->table[5], 'setup')->where('uid = ?', $uidTo ? $uidTo : $this->uid)->order('timestamps DESC')->limit('0,1'); $orderByRaw = $this->db->fetchRow($orderByRaw); $orderByRaw = jdecode($orderByRaw['setup']); $orderBy = array(); if (count($orderByRaw) > 0) { foreach ($orderByRaw as $k => $order) { $orderBy[$k] = decode($order); } } $select = $this->db->select()->from($this->table[1], $uidTo ? array_merge($prop, $select) : $select)->where('status = ?', "Y")->order('priority DESC'); if ($Limit) { $select->limit($Limit[1], $Limit[0]); } $data = $this->db->fetchAll($select); $dat = array(); foreach ($data as $d) { if ($uidTo) { $ans = $this->db->select()->from($this->table[2], array('ans'))->where('qid = ?', $d["id"])->where('uidFrom = ?', $uidFrom)->where('uidTo = ?', $uidTo)->limit(0, 1)->order('timestamps DESC'); $ans = $this->db->fetchRow($ans); $d["ans"] = $ans["ans"]; } $dat[$d["id"]] = $d; unset($dat[$d["id"]]["id"]); } $return = array(); if (count($orderBy) > 0) { foreach ($orderBy as $k) { if ($dat[$k]["que"] != "") { $return[$k] = $dat[$k]; } } } return count($return) > 0 ? array_reverse($return) : $dat; }
function SendInvite($data = array()) { $session = Zend_Registry::get('session'); foreach ($data as $id) { $select = $this->db->select()->from('user_contacts')->where("id = ?", $id); $in = $this->db->fetchRow($select); $this->db->update("user_contacts", array("mailsend" => $in["mailsend"] + 1), "id = '{$id}'"); $my = $this->Info(); $in["name"] = strlen($in["name"]) > 0 ? $in["name"] : "buddy"; //" friend "; $msg = 'Hi ' . $in["name"] . ',<br /><br />What you think about me? Let me know.. Please fill my slambook at the link below:<br /><a href="' . WWW_ROOT . 'i/' . encode($in["id"]) . '">' . WWW_ROOT . 'i/' . encode($in["id"]) . '</a><br /><br />Yours truly,<br />' . $my["fname"] . ' ' . $my["lname"]; $subject = "Pepool Slambook request from " . $my["fname"] . " " . $my["lname"]; if (eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$", $in['email'])) { sendmail($subject, $msg, $in['email'], $in['name']); } else { $msg = 'Hi ' . $in["name"] . ', What you think about me? Let me know.. Please fill my slambook here: ' . WWW_ROOT . 'i/' . encode($in["id"]) . ' i am waiting.'; $I = explode("/", $in['email']); $S = $session->oi_session_id[$I[0]]; $vars = "&check_1=1&message_box=" . $msg . "&email_1=" . $I[1] . "&name_1=" . $in['name'] . "&provider_box=" . $I[0] . "&send=Send invites&step=send_invites&email_box=" . $S["email"] . "&oi_session_id=" . $S["id"]; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, "http://www.pepool.com/OpenInviter/example.php"); curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_ENCODING, "UTF-8"); $content = curl_exec($ch); curl_close($ch); return jdecode($content); } } }