public function getCurrentCity($cityList) { $List = array(); $isdefault = ""; if ($cityList) { foreach ($cityList as $city) { $List[$city["cid"]] = !empty($city["names_en"]) ? strtolower($city["names_en"]) : Pinyin($city["names"]); $List_zh[strtolower($city["names_en"])] = $city["names"]; $isdefault = $city["isdefault"] ? $city["names_en"] : $isdefault; } } $currentcity = isset($_GET["current_city"]) ? strtolower(trim($_GET["current_city"])) : ""; $currentcity = $currentcity == "" && isset($_COOKIE["current_city"]) ? strtolower(trim($_COOKIE["current_city"])) : $currentcity; if (empty($currentcity) || !in_array($currentcity, $List)) { $ip = get_client_ip(); // $ip = "220.173.19.15"; $url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=' . $ip; $json = $this->getHttp($url); $address = json_decode($json, true); $ipcity = empty($address["city"]) ? "nanning" : strtolower(Pinyin($address["city"])); $isdefault = in_array($ipcity, $List) ? $ipcity : $isdefault; $isdefault || ($isdefault = reset($List)); $currentcity = $isdefault; } if (!isset($_COOKIE["current_city"]) || $currentcity != $_COOKIE["current_city"]) { setcookie("current_city", $currentcity, time() + 864000, "/"); } return array("en" => $currentcity, "zh" => $List_zh[$currentcity], "id" => current(array_keys($List, $currentcity))); }
protected function pretreatment() { if ($_GET["id"]) { unset($_POST["model_id"]); } else { $_POST["model_id"] = $_POST["modelId"]; } if (!$_POST["pinyin"]) { $_POST["pinyin"] = Pinyin($_POST["data"]); } //动态新增 if ($_POST["goods_id"]) { list($fa, $goods_id, $cat_id) = explode("_", $_POST["goods_id"]); $_POST["source_id"] = $cat_id; } if ($_POST["modelAlias"]) { $theModel = D("DataModel")->getByAlias($_POST["modelAlias"]); $_POST["model_id"] = $theModel["id"]; } //检测重复项 if ($_POST["model_id"] && $_POST["source_id"] && $_POST["field_id"] && $_POST["data"]) { $_map = array("model_id" => $_POST["model_id"], "source_id" => $_POST["source_id"], "field_id" => $_POST["field_id"], "data" => $_POST["data"]); if (D("DataModelData")->where($_map)->find()) { $this->error("repeat_item"); exit; } } }
function getname($name = null) { if (empty($name)) { return Pinyin(I('title')); } else { return $name; } }
protected function pretreatment() { switch ($this->_method) { case "post": case "put": $_POST["pinyin"] = $_POST["pinyin"] ? $_POST["pinyin"] : Pinyin($_POST["name"]); break; } }
protected function pretreatment() { switch ($this->_method) { case "post": case "put": if (!$_POST["pinyin"]) { $_POST["pinyin"] = Pinyin($_POST["name"]); } break; } }
/** * 增加子节点 */ public function addChildNode($sourceData) { $parent = $this->find($sourceData["pid"]); // if(!is_array($sourceData)) { // $sourceData["name"] = $sourceData; // } if (!$parent) { return false; } //rgt = parent rgt -1 /** * 更新右值 */ $map = array("rgt" => array("EGT", $parent["rgt"])); $this->startTrans(); //$data['lft'] = array("lft", "lft+2"); $data['rgt'] = array("exp", "rgt+2"); $rs = $this->where($map)->save($data); unset($data); /** * 更新左值 */ $map = array("lft" => array("EGT", $parent["rgt"])); //$data['lft'] = array("lft", "lft+2"); $data['lft'] = array("exp", "lft+2"); $rs = $this->where($map)->save($data); unset($data); /** * 插入新值 */ $data = array("lft" => $parent["rgt"], "rgt" => $parent["rgt"] + 1); foreach ($sourceData as $k => $v) { $data[$k] = $v; } $data["pinyin"] = Pinyin($sourceData["name"]); // echo "<pre>"; // print_r($_POST); // echo 1; // print_r($sourceData); // echo 2; // print_r($data); // $this->create($data); $rs = $this->add(); // echo $this->getLastSql();exit; if (!$rs) { Log::write("SQL Error:" . $this->getLastSql(), Log::SQL); $this->rollback(); return false; } $this->commit(); return $rs; }
function getname($name = null) { if (empty($name)) { $py = Pinyin(I('title')); if (strlen($py) > 8) { $py = substr($py, 0, 8); } return $py; } else { return $name; } }
/** * 测试用 * * @todo 删掉 */ function u() { $this->load->helper('pinyin'); $this->load->model('url_m'); $result = $this->url_m->get_all(); $sug = null; $i = 0; foreach ($result as $row) { $tmp = array($row->name, $row->url, Pinyin($row->name)); $sug[$i] = $tmp; $i++; } //var_dump($sug); echo json_encode($sug); }
public function run(&$params) { list($bindModelAlias, $data, $pinyin) = $params; if (!$data["id"]) { return false; } $modelObject = D("DataModel"); $dataModel = $modelObject->getByAlias($bindModelAlias); if (!$dataModel) { Log::write("try to insert model data but dataModel not found: " . $bindModelAlias); return false; } $fieldsModelObject = D("DataModelFields"); $tmp = $fieldsModelObject->where("model_id=" . $dataModel["id"])->select(); $modelFields = array(); $modelFieldsAlias = array(); foreach ($tmp as $row) { $modelFieldsAlias[] = $row["field_name"]; $modelFields[$row["field_name"]] = $row; } //数据 foreach ($data as $k => $v) { if (in_array($k, $modelFieldsAlias)) { if (isset($data[$k . "_label"])) { $modelData[$k] = isset($data[$k . "_label"]); } else { $modelData[$k] = $v; } } } $dataModelObject = D("DataModelData"); $dataModelObject->where(array("source_id" => $data["id"], "model_id" => $dataModel["id"]))->delete(); foreach ($modelData as $fieldName => $fieldValue) { $dataModelObject->add(array("source_id" => $data["id"], "model_id" => $modelFields[$fieldName]["model_id"], "field_id" => $modelFields[$fieldName]["id"], "data" => $fieldValue, "pinyin" => $pinyin ? Pinyin($fieldValue) : "", "deleted" => 0)); } /* * source_id * model_id * field_id * data * pinyin * deleted * **/ }
protected function pretreatment() { if (!$_POST["pinyin"]) { $_POST["pinyin"] = Pinyin($_POST["name"]); } if (!$_GET["id"]) { $_POST["user_id"] = getCurrentUid(); $_POST["dateline"] = CTS; } $tmp["rows"] = array(); foreach ($_POST["rows"] as $k => $row) { if (count($row)) { $tmp["rows"][] = $row; } else { unset($_POST["rows"][$k]); } } $_POST["rows"] = $tmp["rows"]; }
$_String .= chr(0x80 | $_C >> 12 & 0x3f); $_String .= chr(0x80 | $_C >> 6 & 0x3f); $_String .= chr(0x80 | $_C & 0x3f); } return iconv('UTF-8', 'GB2312', $_String); } function _Array_Combine($_Arr1, $_Arr2) { for ($i = 0; $i < count($_Arr1); $i++) { $_Res[$_Arr1[$i]] = $_Arr2[$i]; } return $_Res; } $city = $_GET['city']; //echo $city; $newcity = Pinyin($city, ''); //echo $newcity; if ($newcity) { //字符转换(汉字转换拼音,加载字符集转换函数) //echo $newcity; $content = file_get_contents("http://www.google.com/ig/api?weather={$newcity}&hl=zh-cn"); //print_r($content); //$content || die("No such city's data"); $content = mb_convert_encoding($content, 'UTF-8', 'GBK'); $xml = simplexml_load_string($content); //$date = $xml->weather->forecast_information->forecast_date->attributes(); //$html = $date. "\r\n"; $current = $xml->weather->current_conditions; if ($current) { $condition = $current->condition->attributes(); $temp_c = $current->temp_c->attributes();
/** * 将商品分类列表转换成符合zTree标准的JSON格式 */ function cat_list_to_json($cat_list, $selected = 0) { $json = ''; foreach ($cat_list as $k => $cat) { $id = $cat['cat_id']; $pId = $cat['parent_id']; $name = $cat['cat_name']; //$open = true; $name_pinyin = Pinyin($name, 1, 1) . $name; $json = sprintf('%s{id: %s, pId: %s, name: "%s", name_pinyin: "%s"},', $json, $id, $pId, $name, $name_pinyin); } $json = sprintf('[%s]', $json); return $json; }
/** * 将商品分类列表转换成符合zTree标准的JSON字符串格式 */ function cat_list_to_json_string($cat_list, $selected = 0) { include_once ROOT_PATH . 'includes/Pinyin.php'; $tree = array(); foreach ($cat_list as $k => $cat) { $id = $cat['cat_id']; $pId = $cat['parent_id']; $name = $cat['cat_name']; //$open = true; $name_pinyin = Pinyin($name, 'utf-8', 1) . $name; $node = array("id" => $id, "pId" => $pId, "name" => $name, "name_pinyin" => $name_pinyin); array_push($tree, $node); } return json_encode($tree); }
} $ok = 0; $c_upload = new cls_upload(); $a_field = new cls_field(); foreach ($coclassitems as $item) { $coclassnew = $coclasssome; foreach ($item as $k => $v) { if (is_array($v)) { foreach ($v as $a => $b) { $coclassnew[$k][$a] = $b; } } else { $coclassnew[$k] = $v; } } empty($auto_pinyin) || ($coclassnew['dirname'] = Pinyin($coclassnew['title'])); if (!$coclassnew['title'] || !$coclassnew['dirname']) { continue; } if (preg_match("/[^a-zA-Z_0-9]+/", $coclassnew['dirname'])) { continue; } $coclassnew['dirname'] = strtolower($coclassnew['dirname']); if (empty($auto_pinyin)) { if (in_array($coclassnew['dirname'], $enamearr)) { continue; } } else { $i = 1; $dirname = $coclassnew['dirname']; while (in_array($coclassnew['dirname'], $enamearr)) {
$result2 = $_SGLOBAL['db']->query("select name,username from " . tname('space') . " where uid='{$rs1[$i]}'"); $rs2 = $_SGLOBAL['db']->fetch_array($result2); if (empty($rs2['name'])) { $rs2['name'] = $rs2['username']; } $result3 = $_SGLOBAL['db']->query("select type from " . tname('spaceinfo') . " where uid='{$rs1[$i]}'"); $rs3 = $_SGLOBAL['db']->fetch_array($result3); $atfriends[$count++] = array('uid' => $rs1[$i], 'namequery' => $rs2['name'] . ' ' . Pinyin($rs2['name'], 1) . ' ' . $rs1[$i], 'name' => $rs2['name'], 'avatar' => ''); } //¿¿¿¿¿¿ $query = $_SGLOBAL['db']->query("select uid,name,username from " . tname('space') . " where groupid=3"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (empty($value['name'])) { $value['name'] = $value['username']; } $atfriends[$count++] = array('uid' => $value['uid'], 'namequery' => $value['name'] . ' ' . Pinyin($value['name'], 1) . ' ' . $value['uid'], 'name' => $value['name'], 'avatar' => ''); } $friends = json_encode($atfriends); $friends = preg_replace("#\\\\u([0-9a-f]+)#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $friends); $f = fopen($friendurl_w, "w"); fwrite($f, $friends); fclose($f); } //showmessage('bb');//2013Äê3ÔÂ11ÈÕ10:52:45 for find BUG of friend¡¤¡¤ @Ancon£¡ //ȨÏÞÅÐ¶Ï if (empty($_SGLOBAL['supe_uid'])) { if ($_SERVER['REQUEST_METHOD'] == 'GET') { ssetcookie('_refer', rawurlencode($_SERVER['REQUEST_URI'])); } else { ssetcookie('_refer', rawurlencode('cp.php?ac=' . $ac)); }
function update($module = '', $fields = array(), $userid = 0, $username = '') { $model = $module ? M($module) : $this->dao; $fields = $fields ? $fields : $this->fields; if ($fields['verifyCode']['status'] && md5($_POST['verifyCode']) != $_SESSION['verify']) { $this->assign('jumpUrl', 'javascript:history.go(-1);'); $this->error(L('error_verify')); } $_POST = checkfield($fields, $_POST); if (empty($_POST)) { $this->error(L('do_empty')); } $_POST['updatetime'] = time(); if ($_POST['style_color']) { $_POST['style_color'] = 'color:' . $_POST['style_color']; } if ($_POST['style_bold']) { $_POST['style_bold'] = ';font-weight:' . $_POST['style_bold']; } if ($_POST['style_color'] || $_POST['style_bold']) { $_POST['title_style'] = $_POST['style_color'] . $_POST['style_bold']; } $cat = $this->categorys[$_POST['catid']]; $module = $module ? $module : MODULE_NAME; $_POST['url'] = geturl($cat, $_POST, $this->Urlrule); $_POST['url'] = $_POST['url'][0]; $olddata = $model->find($_POST['id']); if (false === $model->create()) { $this->error($model->getError()); } // 更新数据 $list = $model->save(); if (false !== $list) { $id = $_POST['id']; $catid = $module == 'Page' ? $id : $_POST['catid']; if ($olddata['keywords'] != $_POST['keywords'] && $module != 'Page') { $tagidarr = $tagdatas = $where = array(); $where['name'] = array('in', $olddata['keywords']); $where['moduleid'] = array('eq', $cat['moduleid']); $where['lang'] = array('eq', $_POST['lang']); M('Tags')->where($where)->setDec('num'); $tagsdata = M('Tags_data'); $tagsdata->where("id=" . $id)->delete(); $keywordsarr = explode(',', $_POST['keywords']); foreach ((array) $keywordsarr as $tagname) { if ($tagname) { $tagidarr = $tagdatas = $where = array(); $where['name'] = array('eq', $tagname); $where['moduleid'] = array('eq', $cat['moduleid']); $where['lang'] = array('eq', $_POST['lang']); $tagid = M('Tags')->where($where)->field('id')->find(); $tagidarr['id'] = $id; if ($tagid['id'] > 0) { M('Tags')->where("id=" . $tagid[id])->setInc('num'); $tagidarr['tagid'] = $tagid['id']; } else { $tagdatas['moduleid'] = $cat['moduleid']; $tagdatas['name'] = $tagname; $tagdatas['slug'] = Pinyin($tagname); $tagdatas['num'] = 1; $tagdatas['lang'] = $_POST['lang']; $tagdatas['module'] = $cat['module']; $tagidarr['tagid'] = M('Tags')->add($tagdatas); } $tagsdata->add($tagidarr); } } M('Tags')->where('num<=0')->delete(); } if ($_POST['aid']) { $Attachment = M('Attachment'); $aids = implode(',', $_POST['aid']); $data['id'] = $id; $data['catid'] = $catid; $data['status'] = '1'; $Attachment->where("aid in (" . $aids . ")")->save($data); } $cat = $this->categorys[$catid]; if ($cat['ishtml']) { if ($module != 'Page' && $_POST['status']) { $this->create_show($_POST['id'], $module); } $arrparentid = array_filter(explode(',', $cat['arrparentid'] . ',' . $cat['id'])); foreach ($arrparentid as $catid) { if ($this->categorys[$catid]['ishtml']) { $this->clisthtml($catid); } } } if ($this->sysConfig['HOME_ISHTML']) { $this->create_index(); } $this->assign('jumpUrl', $_POST['forward']); $this->success(L('edit_ok')); } else { //错误提示 $this->success(L('edit_error') . ': ' . $model->getDbError()); } }
function get_brand_list($t = false) { $sql = 'SELECT brand_id, brand_name, brand_name_cn FROM ' . $GLOBALS['ecs']->table('brand') . ' ORDER BY sort_order ASC, brand_id ASC'; $res = $GLOBALS['db']->getAll($sql); $brand_list = array(); foreach ($res as $row) { // 代码修改_start_derek20150129admin_goods www.68ecshop.com if ($t == true) { $brand_list[$row['brand_id']]['name'] = addslashes($row['brand_name'] . ' ' . $row['brand_name_cn']); $brand_list[$row['brand_id']]['name_pinyin'] = Pinyin($brand_list[$row['brand_id']]['name'], 1, 1); $brand_list[$row['brand_id']]['name_p'] = substr($brand_list[$row['brand_id']]['name_pinyin'], 0, 1); } else { $brand_list[$row['brand_id']] = addslashes($row['brand_name'] . ' ' . $row['brand_name_cn']); } // 代码修改_end_derek20150129admin_goods www.68ecshop.com } return $brand_list; }
/** *添加会员 */ function manageusermodify_action() { $updateid = intval($_REQUEST['updateid']); $user_mod = new common('admin'); $user = array(); if (submitcheck('commit')) { $data['username'] = trim(strip_tags($_POST['username'])); $data['usertype'] = "adminuser"; $data['email'] = trim(strip_tags($_POST['email'])); $author['username'] = $data['username']; $author['urlname'] = Pinyin($data['username']); $author['email'] = $data['email']; $author['created_at'] = time(); $author['location'] = ""; if ($updateid > 0) { $user = $user_mod->GetOne('and uid=' . $updateid); if (!empty($_POST['password'])) { $data['passwd'] = md52($_POST['password']); $author['passwd'] = $data['passwd']; } if ($user_mod->UpdateData($data, 'and uid=' . $updateid)) { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=manageuser&type=manageuser', 3, '修改成功', 'redirect', true); } else { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=manageuser&type=manageuser', 3, '修改失败', 'redirect', true); } } else { $data['passwd'] = md52($_POST['password']); $author['passwd'] = $data['passwd']; $user_mod->InsertData($data); sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=manageuser&type=manageuser', 3, '添加成功', 'redirect', true); } } else { if ($updateid) { $user_mod->GetOne('and uid=' . $updateid); } include ROOT_PATH . '/views/admin/manageuser_form.php'; } }
<?php if ($this->session->userdata('level') == 1 || $this->session->userdata('level') == 2) { ?> <span style="color:#104E8B; cursor:pointer; float:right" onclick="editApi('<?php echo site_url('c=add&m=edit&id=' . $value['id']) . '&cid=' . $_GET['cid']; ?> ');">编辑</span><?php } ?> </li> <!--接口关键字(js通过此关健字进行模糊查找)start--> <span class="keyword" id="<?php echo $value['id']; ?> "><?php echo Pinyin($value['title']); ?> <?php echo $value['title']; ?> </span> <!--接口关键字(js通过此关健字进行模糊查找)end--> <?php } ?> </ul> </div> <!--jquery模糊查询start--> <script> var $COOKIE_KEY = "API_NAVBAR_STATUS"; //记录左侧菜单栏的开打与关闭状态的cookie的值
break; } } } if (!$abover_result) { $abover_result = ''; } //小说主信息 $do_subject = sbyou_NET_subject($subject, $author, $ready_1, $thumb, $content); if (!$do_subject || $do_subject == '发布失败') { $www_669977_net .= '<p class="red">抱歉,发布失败,请您稍后重试...</p>'; } else { $row = $dsql->GetOne("select * from dede_arctype where typename='{$subject}' and zuozhe='{$author}' and topid='{$caid_result}' order by id desc limit 1"); if ($row['id']) { $cnt = $dsql->GetOne("select count(id) as cnt from dede_arctype where typedir='" . $row['typedir'] . "'"); $name = "/" . Pinyin($subject) . rand(0, 100); if (intval($cnt['cnt']) > 1) { $dsql->ExecuteNoneQuery("UPDATE dede_arctype SET typedir='{$name}' where id='" . $row['id'] . "'"); } } if ($do_subject == '跳过火车采集') { $www_669977_net .= '<p class="red">恭喜您,发布成功!但是并未入库,因为此小说已经设置为“不参与火车头采集”!</p>'; } else { //小说副信息 $do_article = sbyou_NET_title($subject, $title, $article); if ($do_article == '章节已经存在') { $www_669977_net .= '<p class="red">恭喜您,发布成功!但是并未入库,因为此章节已经存在!</p>'; } else { if ($do_article == '发布成功') { $www_669977_net .= '<p class="red">恭喜您,发布成功!</p>'; } else {
/** * 汉字转为拼音 * @param $str 中文 * @return $res 拼音 */ function pinyin($str, $charset = 'gb2312') { return Pinyin($str, $charset); }
$ok = 0; $c_upload = new cls_upload(); $a_field = new cls_field(); foreach ($catalogitems as $item) { $catalognew = $catalogsame; foreach ($item as $k => $v) { if (is_array($v)) { foreach ($v as $a => $b) { $catalognew[$k][$a] = $b; } } else { $catalognew[$k] = $v; } } $catalognew['title'] = trim(strip_tags($catalognew['title'])); empty($auto_pinyin) || ($catalognew['dirname'] = Pinyin($catalognew['title'])); if (!$catalognew['title'] || !$catalognew['dirname']) { continue; } if (preg_match("/\\W/", $catalognew['dirname'])) { continue; } $catalognew['dirname'] = strtolower($catalognew['dirname']); if (empty($auto_pinyin)) { if (in_array($catalognew['dirname'], $enamearr)) { continue; } } else { $i = 1; $dirname = $catalognew['dirname']; while (in_array($catalognew['dirname'], $enamearr)) {
/** * 提交编辑 * */ public function update() { if (empty($_POST['urlruleid']) && $_POST['ishtml']) { $this->error(L('do_empty')); } $_POST['module'] = $this->module[$_POST['moduleid']]['name']; $_POST['readgroup'] = $_POST['readgroup'] ? implode(',', $_POST['readgroup']) : ''; $_POST['postgroup'] = $_POST['postgroup'] ? implode(',', $_POST['postgroup']) : ''; $_POST['arrparentid'] = $this->get_arrparentid($_POST['id']); if (empty($_POST['listtype'])) { $_POST['listtype'] = 0; } $_POST['catdir'] = $_POST['catdir'] ? $_POST['catdir'] : Pinyin($_POST['catname']); if ($_POST['type']) { $_POST['moduleid'] = 0; $_POST['module'] = ''; } if (false === $this->dao->create()) { $this->error($this->dao->getError()); } if (false !== $this->dao->save()) { if ($_POST['aid']) { $Attachment = M('Attachment'); $aids = implode(',', $_POST['aid']); $data['moduleid'] = $_POST['moduleid']; $data['catid'] = $_POST['id']; $data['status'] = '1'; $Attachment->where("aid in (" . $aids . ")")->save($data); } if ($_POST['chage_all']) { $data = array(); $arrchildid = $this->get_arrchildid($_POST['id']); $data['urlruleid'] = $_POST['urlruleid'] ? $_POST['urlruleid'] : '0'; $data['presentpoint'] = $_POST['presentpoint']; $data['postgroup'] = $_POST['postgroup'] ? $_POST['postgroup'] : ''; $data['chargepoint'] = $_POST['chargepoint']; $data['paytype'] = $_POST['paytype']; $data['repeatchargedays'] = $_POST['repeatchargedays']; $data['ismenu'] = $_POST['ismenu']; $data['ishtml'] = $_POST['ishtml']; $data['pagesize'] = $_POST['pagesize']; $data['template_list'] = $_POST['template_list']; $data['template_show'] = $_POST['template_show']; $data['readgroup'] = $_POST['readgroup'] ? $_POST['readgroup'] : ''; $r = $this->dao->where(' id in (' . $arrchildid . ')')->data($data)->save(); } $this->repair(); $this->repair(); savecache('Category'); if ($_POST['ishtml']) { $cat = $this->categorys[$_POST['id']]; $arrparentid = array_filter(explode(',', $cat['arrparentid'] . ',' . $cat['id'])); foreach ($arrparentid as $catid) { if ($this->categorys[$catid]['ishtml']) { $this->clisthtml($catid); } } } if ($this->sysConfig['HOME_ISHTML']) { $this->create_index(); $this->create_index(1); } $this->assign('jumpUrl', U(MODULE_NAME . '/index')); $this->success(L('edit_ok')); } else { $this->success(L('edit_error') . ': ' . $this->dao->getDbError()); } }
} $deprank[$result['uid']]['downnum'] += 1; $deprank[$result['uid']]['updownnum'] += 1; } } $query = $_SGLOBAL['db']->query("select uid, count(opid) replynum, sum(replysecs) replysecs from " . tname('complain_resp') . " where dateline>={$starttime} and dateline<{$endtime} group by uid"); while ($result = $_SGLOBAL['db']->fetch_array($query)) { $deprank[$result['uid']]['replynum'] = $result['replynum']; $deprank[$result['uid']]['replysecs'] = $result['replysecs']; } foreach ($deprank as $uid => $info) { if (count($info) <= 3) { continue; } inserttable('complain_dep_rank', $info); $log->debug("update dep rank {$uid} upnum {$info['upnum']} downum {$info['downnum']}"); } $starttime = mktime(0, 0, 0, date("m"), 1, date("Y")); $endtime = mktime(0, 0, 0); $wheresql = " where dateline>={$starttime} and dateline<{$endtime} "; $order = " order by realcomplainnum desc "; $query = $_SGLOBAL['db']->query("select * from " . tname('powerlevel') . " o left join (select uid, sum(complainnum) realcomplainnum from " . tname("complain_dep_rank") . $wheresql . " group by uid) t on o.dept_uid = t.uid " . $order); while ($PowerArray = $_SGLOBAL['db']->fetch_array($query)) { if ($PowerArray['isdept']) { //去掉多余信息,仅保留uid 和 name ,用于at功能用 $powerjson = array('department' => $PowerArray['department'], 'dept_uid' => $PowerArray['dept_uid'], 'namequery' => $PowerArray['department'] . ' ' . Pinyin($PowerArray['department'], 1) . ' ' . $PowerArray['dept_uid'], 'depduty' => $PowerArray['depduty']); $powerJsons[] = $powerjson; } } $powerJsons = json_encode($powerJsons); echo file_put_contents(S_ROOT . './data/powerlevel/powerlevel.json', $powerJsons);
} } } if ($legalEntity) { $complain['relay_times'] = $relay_records[$legalEntity]; } $query = $_SGLOBAL['db']->query("select a.uid as uid,a.name as name,a.username as username from " . tname('space') . " as a," . tname("powerlevel") . " as b where a.uid = b.dept_uid and b.isdept = 1"); $deps = array(); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (empty($value['name'])) { $value['name'] = $value['username']; } if ($value["uid"] == $_SGLOBAL['supe_uid'] || $value["uid"] == $legalEntity) { continue; } $v = array('name' => $value['name'], 'uid' => $value['uid'], 'namequery' => $value['name'] . ' ' . Pinyin($value['name'], 1) . ' ' . $value['uid']); $deps[] = $v; } $deps = str_replace('"', '"', json_encode($deps)); $query = $_SGLOBAL['db']->query("select * from " . tname('complain_op') . " where doid={$doid}"); $complain_ops = array(); $opids = array(); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $complain_ops[$value['id']] = $value; realname_set($value['uid'], $value['username']); if ($value['optype'] == 3) { realname_set(intval($value['opvalue']), ''); } $opids[] = $value['id']; } // $commenttree = new tree();
function friend_cache($uid, $puid = 0) { global $_SGLOBAL, $space, $_SCONFIG; if (!empty($space) && $space['uid'] == $uid) { $thespace = $space; } else { $thespace = getspace($uid); } if (empty($thespace)) { return false; } $groupids = empty($thespace['privacy']['filter_gid']) ? array() : $thespace['privacy']['filter_gid']; //好友缓存 $max_friendnum = 200; //最多显示feed好友数 $friendlist = $fmod = $feedfriendlist = $ffmod = ''; $friendat = $publicpageat = $newfriendlist = $publicpagelist = $oldfeedfriendlist = $difflist = array(); $i = $count = 0; $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('friend') . " WHERE uid='{$uid}' AND status='1' ORDER BY num DESC, dateline DESC"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if ($value['fuid']) { $newfriendlist[] = $value['fuid']; //存储好友数组by xuxing 2012-09-21 //$friendat[] = $value;//存储好友数组信息by xuxing 2012-10-20 $friendlist .= $fmod . $value['fuid']; $fmod = ','; if ($i < $max_friendnum && (empty($groupids) || !in_array($value['gid'], $groupids))) { $feedfriendlist .= $ffmod . $value['fuid']; $ffmod = ','; $i++; } $count++; } } // 加入已有公共主页的关注 start by xuxing 2012-09-21 9:50 //获取所有的公共主页 $query = $_SGLOBAL['db']->query("SELECT uid,name,username FROM " . tname('space') . " WHERE groupid=3 "); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $publicpagelist[] = $value['uid']; $publicpageat[] = $value; //存储公共主页数组信息by xuxing 2012-10-20 } //取出现有的feedfriend $query = $_SGLOBAL['db']->query("SELECT feedfriend FROM " . tname('spacefield') . " WHERE uid='{$uid}' "); if ($value = $_SGLOBAL['db']->fetch_array($query)) { $oldfeedfriendlist = explode(",", $value['feedfriend']); //循环处理现有feedfriend与最新好友列表的差集,如果为公共主页则更新好友列表中,以便作为feedfriend。 foreach (array_diff($oldfeedfriendlist, $newfriendlist) as $tmpuid) { if (in_array($tmpuid, $publicpagelist) && $tmpuid != $puid) { $newfriendlist[] = $tmpuid; } } $newfriendlist = array_flip(array_flip($newfriendlist)); //唯一化数组 $newfriendlist = array_filter($newfriendlist); //如果feedfriendlist只有一个好友,则不用“,”进行分隔; if (count($newfriendlist) > 1) { $feedfriendlist = implode(",", $newfriendlist); } elseif (count($newfriendlist) == 1) { $feedfriendlist = $newfriendlist[0]; } //showmessage($feedfriendlist); } // 加入已有公共主页的关注 end by xuxing 2012-09-21 9:50 if ($count > 50000) { $friendlist = ''; //超过不再缓存 } updatetable('spacefield', array('friend' => $friendlist, 'feedfriend' => $feedfriendlist), array('uid' => $uid)); //数量 if ($thespace['friendnum'] != $count) { updatetable('space', array('friendnum' => $count), array('uid' => $uid)); } //变更记录 if ($_SCONFIG['my_status']) { inserttable('userlog', array('uid' => $uid, 'action' => 'update', 'dateline' => $_SGLOBAL['timestamp']), 0, true); } // 加入@列表的JSON格式写入 start by xuxing 2012-10-20 19:58 $friendurl_w = S_ROOT . "./data/assets/data_" . $uid . ".json"; //$friendurl_r = "data/assets/data_".$uid.".json"; $atfriends = array(); $count = 0; if ($count > 0) { $query = $_SGLOBAL['db']->query("SELECT uid,name,username FROM " . tname('space') . " WHERE uid in ({$friendlist}) "); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $friendat[] = $value; } } foreach ($friendat as $value) { if (empty($value['name'])) { $value['name'] = $value['username']; } $atfriends[] = array('uid' => $value['uid'], 'namequery' => $value['name'] . ' ' . Pinyin($value['name'], 1) . ' ' . $value['uid'], 'name' => $value['name'], 'avatar' => ''); } foreach ($publicpageat as $value) { if (empty($value['name'])) { $value['name'] = $value['username']; } $atfriends[] = array('uid' => $value['uid'], 'namequery' => $value['name'] . ' ' . Pinyin($value['name'], 1) . ' ' . $value['uid'], 'name' => $value['name'], 'avatar' => ''); } //$atfriends = array_flip(array_flip($atfriends)); $friends = json_encode($atfriends); $friends = preg_replace("#\\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $friends); $f = fopen($friendurl_w, "w"); fwrite($f, $friends); fclose($f); // 加入@列表的JSON格式写入 end by xuxing 2012-10-20 }
$tpltype = '1'; if (getGP('tpluser', 'P') != '') { $tpluser = getGP('tpluser', 'P'); } else { $tpluser = '******'; } if (getGP('tpladmin', 'P') != '') { $tpladmin = getGP('tpladmin', 'P'); } else { $tpladmin = '0'; } $uid = $_USER->id; if (getGP('tpladdr', 'P') != '') { $tpladdr = getGP('tpladdr', 'P'); } else { $tpladdr = Pinyin($title) . '.php'; } //主表信息 $workclass_template = array('title' => $title, 'typeid' => $typeid, 'tplkey' => $tplkey, 'tpltype' => $tpltype, 'tpluser' => $tpluser, 'tpladmin' => $tpladmin, 'uid' => $uid, 'tpladdr' => $tpladdr); //写入主表信息 insert_db('workclass_template', $workclass_template); $id = $db->insert_id(); $content = serialize($workclass_template); $title = '添加工作流模型'; get_logadd($id, $content, $title, 35, $_USER->id); show_msg('工作流模型添加成功!', 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''); } elseif ($do == 'edit') { $tplid = getGP('tplid', 'G', 'int'); $blog = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "workclass_template WHERE tplid = '{$tplid}'"); include_once 'mana/template_edit.php'; } elseif ($do == 'editsave') {
if (empty($col_capital_name)) { $sql_add_capital = "ALTER TABLE {$region_table} ADD `capital` char(1) not null DEFAULT 'A' "; $db->query($sql_add_capital); } if (empty($col_pinyin_name)) { $sql_add_capital = "ALTER TABLE {$region_table} ADD `pinyin` varchar(50) not null DEFAULT 'abcd' "; $db->query($sql_add_capital); } if (empty($col_capital_name) || empty($col_pinyin_name)) { $sql = "SELECT region_id,region_name FROM {$region_table}"; $rows = array(); $rows = $db->getAll($sql); //dump($rows); foreach ($rows as $row) { //echo $row['region_name']; $spell = Pinyin($row['region_name'], 'utf-8'); if ($row['region_name'] == '亳州') { $spell = 'bozhou'; } if ($row['region_name'] == '儋州') { $spell = 'danzhou'; } if ($row['region_name'] == '衢州') { $spell = 'quzhou'; } if ($row['region_name'] == '重庆') { $spell = 'chongqing'; } $capital = strtoupper(substr($spell, 0, 1)); $sql_update = "UPDATE {$region_table} SET capital = '{$capital}',pinyin = '{$spell}' WHERE region_id = '" . $row['region_id'] . "'"; $db->query($sql_update);
','<?php echo $value['m_id']; ?> ');"> 删除</span><?php } ?> <br> <hr> </li> <!--接口分类关键字(js通过此关健字进行模糊查找)start--> <span class="keyword" id="<?php echo $value['m_id']; ?> "><?php echo Pinyin($value['m_name']); ?> <?php echo $value['m_name']; ?> <?php foreach ($value['get_list_info_title'] as $k => $v) { echo $v['title'] . "  "; } ?> <|-|><?php echo $value['m_name']; ?> 接口</span> <!--接口关键字(js通过此关健字进行模糊查找)end--> <?php
function _autoInsertGroup($ids) { $container = $ids == -1 ? 'and id>0' : 'and id in (' . ($ids ? $ids : 0) . ')'; $data = $this->tempsite->GetPage(array('isshow' => 0), $container); set_time_limit(0); foreach ($data as $k => $v) { $o = $v['oldprice'] > 0 ? $v['oldprice'] : 1; $data[$k]['discount'] = intval($v['nowprice'] * 100 / $v['oldprice']) / 10; $newtime = explode('+', $v['lasttime']); $startnewtime = explode('+', $v['starttime']); $data[$k]['grouptype'] = $grouptype; $data[$k]['cityname'] = $v['cityname'] ? $v['cityname'] : '其它'; $data[$k]['cityid'] = $v['cityname'] ? Pinyin($v['cityname']) : 'qita'; $lasttime = str_replace('日', '', str_replace('月', '-', str_replace('年', '-', trim($newtime[0])))); $lasttime = str_replace('秒', '', str_replace('分', ':', str_replace('时', ':', $lasttime))); $starttime = str_replace('日', '', str_replace('月', '-', str_replace('年', '-', trim($startnewtime[0])))); $starttime = str_replace('秒', '', str_replace('分', ':', str_replace('时', ':', $starttime))); $data[$k]['lasttime'] = strtotime($lasttime) > 0 ? strtotime($lasttime) : $lasttime; $data[$k]['starttime'] = strtotime($starttime) > 0 ? strtotime($starttime) : $starttime; $data[$k]['ispassed'] = $GLOBALS['setting']['site_allow_passed'] ? 1 : 0; if ($v['thumb']) { if ($GLOBALS['allowremote']) { $thumb = $this->curl->get($v['thumb']); if ($thumb) { $file = explode('.', $v['thumb']); $dir = 'data/upload/' . date('Y/m'); mkdir2(ROOT_PATH . '/' . $dir); $stuff = str_replace('/', '', $file[count($file) - 1]); if (!in_array(substr($stuff, 4), array('jpeg', 'png', 'jpg', 'gif'))) { $stuff = 'jpg'; } $file = md52(microtime()) . '.' . $stuff; writefile(ROOT_PATH . '/' . $dir . '/' . $file, $thumb); $data[$k]['thumb'] = $dir . '/' . $file; } else { $data[$k]['thumb'] = $v['thumb']; } } } } foreach ($data as $k => $v) { $group = $this->group->GetOne('and subject="' . global_addslashes($v['subject']) . '" and siteid=' . $v['siteid']); if (!$group) { unset($v['id']); $this->group->InsertData($v); } } $this->tempsite->DeleteData('1 ' . $container); sleep(1); }