function save_track($msg, $id, $name, $mail) { $pdt = time(); $iq = hostname(); //ses('iq'); if (is_numeric($id) or substr($id, 0, 4) == 'wall') { $local = true; } if (!$msg) { return; } // btn('popdel','bruuu! '.helps('empty_msg')); req('sav'); $qb = $_SESSION['qb']; $base = $_SESSION['qdi']; $_GET['idy'] = 'ok'; $_GET['insert'] = 'ok'; $_POST['name'] = $nm; $_POST['msg'] = $msg; if (!rstr(2) or auth(4)) { $op = 1; } else { $op = 0; } $here = host() . '/?read=' . $id; $msg = str_replace(":chat", "", $msg); $msg = repair_latin($msg); $msg = embed_links($msg); //$amsg=mysql_real_escape_string(stripslashes($msg)); $values = array($ib, $name, $mail, $pdt, $qb, $id, $suj, $msg, $op, $ip); //,'','','' $nread = insert('qdi', mysqlra($values)); $suj = $local ? suj_of_id($id) : nms(84); $nmsg = lka($here . '#trk' . $nread, $local ? helps('trackmail') : nms(84)) . br() . br(); $nmsg .= nms(68) . ': ' . $name . ', ' . mkday($pdt) . br() . br() . format_txt($msg, '', ''); $admail = $_SESSION['qbin']['adminmail']; //to_admin if ($name != $_SESSION['USE']) { send_mail_html($admail, $suj, $nmsg, $mail, urlread($id)); } if ($local) { $rmails = sql('mail', 'qdi', 'k', 'frm="' . $id . '" AND re>="1"'); } //deploy $kem = sql('name', 'qda', 'v', 'id="' . $id . '"'); //send_to_author if ($kem != $name) { $kmail = sql('mail', 'qdu', 'v', 'name="' . $kem . '"'); if ($admail != $kmail) { $rmails[$kmail] = 1; } } //send_track_to_user if ($rmails && $op == 1) { send_mail_r(array_keys_b($rmails), 'html', $suj, $nmsg, $mail, $id); } if (!$local) { return popup(nms(34), divc('', helps('formail')), ''); } return tracks_read($nread, '', ''); }
function troc_prop_add($id, $rid, $res) { $res = ajxg($res); $ex = sql('id', 'prop', 'v', 'id="' . $id . '" and prop="' . $res . '"'); if ($res && !$ex) { insert('prop', mysqlra(array($id, $res, ''))); } return troc_edit($id, $rid); }
function mysqlrb($r) { foreach ($r as $k => $v) { $rb[] = mysqlra($v); } return implode(',', $rb); }