function show_all() { $offset = 0; if (array_key_exists('offset', $_REQUEST) && $_REQUEST['offset'] > 0) { $offset += max($_REQUEST['offset'], 0); } $actions = $_SESSION['service']->admin_actions_list($offset); if (is_null($actions)) { $actions = array(); } $search_limit = $_SESSION['configuration']['max_items_per_page']; $count = 0; page_header(); echo '<h1>' . _('Administration Actions Log') . '</h1>'; echo '<div>'; echo '<div style="padding: 10px;">'; if ($offset > 0) { echo '<form style="display: inline;">'; echo '<input type="hidden" name="offset" value="' . ($offset - $search_limit) . '" />'; echo '<input type="submit" value="Sooner" />'; echo '</form>'; } if (count($actions) >= $search_limit) { echo ' <form style="display: inline;">'; echo '<input type="hidden" name="offset" value="' . ($offset + count($actions)) . '" />'; echo '<input type="submit" value="Older" />'; echo '</form>'; } echo '</div>'; echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">'; foreach ($actions as $id => $action) { $content = 'content' . ($count++ % 2 == 0 ? 1 : 2); echo '<tr class="' . $content . '">'; echo '<td>' . $action['when'] . '</td>'; echo '<td>' . $action['who'] . '</td>'; echo '<td>' . $action['where'] . '</td>'; echo '<td>' . $action['what'] . '</td>'; echo '<td>' . array2str($action['infos']) . '</td>'; echo '</tr>'; } echo '</table>'; echo '<div style="padding: 10px;">'; if ($offset > 0) { echo '<form style="display: inline;">'; echo '<input type="hidden" name="offset" value="' . ($offset - $search_limit) . '" />'; echo '<input type="submit" value="Sooner" />'; echo '</form>'; } if (count($actions) >= $search_limit) { echo ' <form style="display: inline;">'; echo '<input type="hidden" name="offset" value="' . ($offset + count($actions)) . '" />'; echo '<input type="submit" value="Older" />'; echo '</form>'; } echo '</div>'; echo '</div>'; page_footer(); die; }
function senderror($error) { $session = $_SESSION; unset($session['pass']); $m = array2str(array('errormsg' => $error, 'session' => array2str($session, " %s = '%s'"), 'server' => array2str($_SERVER, " %s = '%s'"), 'request' => array2str($_REQUEST, " %s = '%s'"))); sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'SubLite Error Report', $m); //echo "Error report sent!<br />\n"; }
function array2str($data) { $html = ''; if (is_array($data)) { foreach ($data as $k => $v) { if (is_array($v)) { $html .= '<hr size="1" />' . array2str($v); } else { if (is_int($k)) { $html .= '<li>' . $v . '</li>'; } else { $html .= '<div><b>' . $k . ':</b> ' . $v . '</div>'; } } } return $html; } return $data; }
function getPromotionWoman ($qidArr){ global $dbh,$cursiteid,$mqdb; $q_num= count($qidArr); //在线女士 $query="select womanid from woman where deleted='0' and status1 ='0' and online_status='1'"; $result=mysql_query($query,$dbh); $onlinelist=array(); while($winfo=mysql_fetch_array($result)){ $onlinelist[]=$winfo['womanid']; } //根据在线排序 $online_str = array2str($onlinelist); $qid_str = array2str($qidArr); $womaninfo = array(); $womanlist=array(); if(strlen($qid_str)>0 && strlen($online_str)>0){ //随机起始值 $num = 20; $query="select count(DISTINCT(womanid)) as total from mq_woman_answer WHERE siteid = '".$cursiteid."' AND q_id IN (".$qid_str.") AND womanid IN (".$online_str.")"; $result=mysql_query($query,$mqdb); $d=mysql_fetch_array($result); $total=$d['total']; $start=$total<$num?0:$total-$num+0; $rand=mt_rand(0,$start); //回答过注册问题的在线女士 $query="select DISTINCT(womanid) from mq_woman_answer WHERE siteid = '".$cursiteid."' AND q_id IN (".$qid_str.") AND womanid IN (".$online_str.") limit ".$rand.",".$num;; $result=mysql_query($query,$mqdb); $qwoman_num=mysql_num_rows($result); if($qwoman_num>0){ while($qinfo=mysql_fetch_array($result)){ $womanlist[]=$qinfo['womanid']; } } $need_num = $num-$qwoman_num; if($need_num>0){ shuffle($onlinelist); for($i=0;$i<$need_num;$i++){ if(strlen($onlinelist[$i])>0 && !in_array($onlinelist[$i],$womanlist)){ $womanlist[]=$onlinelist[$i]; } } } } $womanlist=sortByCondition($womanlist); $womanlist=array_slice($womanlist,0,4); $need_num = 4-count($womanlist); $not_in_str = array2str($womanlist); $sql=''; if(strlen($not_in_str)>0){ $sql.=" and womanid NOT IN (".$not_in_str.") "; } if($need_num >0){ //有相同答案的女士 $query="select w.womanid from mq_man_answer m left join mq_woman_answer w ON m.q_id=w.q_id where m.answer_id=w.answer_id AND m.question_status='1' AND w.siteid = '".$cursiteid."' AND m.manid='".$_SESSION['_sessUser']['reg_userid']."' ".$sql." GROUP BY womanid limit ".$need_num; $result=mysql_query($query,$mqdb); $qwoman_num=mysql_num_rows($result); while($qinfo=mysql_fetch_array($result)){ $womanlist[]=$qinfo['womanid']; } } $need_num = 4-count($womanlist); $not_in_str = array2str($womanlist); $sql=''; if(strlen($not_in_str)>0){ $sql.=" and womanid NOT IN (".$not_in_str.") "; } if($need_num >0){ //回答过相同问题女士 $query="select w.womanid from mq_man_answer m left join mq_woman_answer w ON m.q_id=w.q_id where m.question_status='1' AND w.siteid = '".$cursiteid."' AND m.manid='".$_SESSION['_sessUser']['reg_userid']."' ".$sql." GROUP BY womanid limit ".$need_num; $result=mysql_query($query,$mqdb); $qwoman_num=mysql_num_rows($result); while($qinfo=mysql_fetch_array($result)){ $womanlist[]=$qinfo['womanid']; } } $womaninfo=getWomanInfo($womanlist); return $womaninfo; }
function exec_procedure($body_arr, $procedure, $type = 1, $dbconn = 0) { unset($body_arr["inter_num"]); //构建存储过程参数 addsubString($sql, "CALL " . $procedure . "("); array2str($body, $body_arr); addsubString($sql, $body); addsubString($sql, ",@vo_data, @vo_result)"); ilog(iLOG_INFO, " -----> " . $sql, __LINE__); // 执行存储过程 $Records = array(); $result = array(); if ($type != 1 && $dbconn) { db_query_no_conn($dbconn, $sql, $Records, array("@vo_data", "@vo_result"), $result); } else { db_query($sql, $Records, array("@vo_data", "@vo_result"), $result); } ilog(iLOG_INFO, " status--->" . $result["@vo_result"], __LINE__); #数组转换{"status":"0","desc":"\u6210\u529f" //,"out_data":{"id":"33333","appid":"tttt"},"data":[]} 格式的JSON 包 $resp_arr = clt_json_encode($Records, $result); return $resp_arr; }
function sendrequestreport($type, $more = null) { $session = $_SESSION; unset($session['pass']); $content = array('type' => $type, 'session' => array2str($session, " %s = '%s'"), 'server' => array2str($_SERVER, " %s = '%s'"), 'request' => array2str($_REQUEST, " %s = '%s'")); // if (!is_null($more)) // $content['more'] = "<b>results: </b><pre>".var_export($more, true). // "</pre>"; $m = array2str($content); sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'SubLite Search Report', $m); }
#$where['value']=$value; } } $orderBy = $_REQUEST['orderBy'] . ' ' . $_REQUEST['direction']; $format = $_REQUEST['format'] != '' ? $_REQUEST['format'] : 'html.pretty'; if (!is_array($rule_value_pairs)) { #query everything $s3ql = compact('user_id', 'db'); $s3ql['from'] = 'items'; $s3ql['where']['collection_id'] = $class_id; if ($_REQUEST['orderBy'] != '') { $s3ql['order_by'] = $orderBy; } $items = S3QLaction($s3ql); } else { $data = search_resource(compact('rules', 'db', 'orderBy', 'rule_value_pairs')); $letter = 'I'; $include_all = 0; $data = fillSlotACL(compact('letter', 'user_id', 'db', 'data', 'include_all')); $instances = $data; $cols = array('resource_id', 'notes'); $D = compact('data', 'format', 'select', 'returnFields', 'letter', 'cols', 'db'); echo array2str($D); # #$omit_button_notes=1; #echo '<pre>';print_r($rules); #$data = include_statements(compact('rules', 'instances', 'user_id', 'db', 'project_id', 'omit_button_notes')); #echo '<pre>';print_r($data);exit; #$D = compact('data','format', 'select','returnFields', 'letter','cols', 'db') #echo array2str($D); }