public function node() { $node_model = M("Node"); if (!empty($_POST['eq_pid'])) { $eq_pid = $_POST['eq_pid']; } else { $eq_pid = $node_model->where('pid=0')->order('sort asc')->getField('id'); } //dump($node_model -> select()); $node_list = $node_model->order('sort asc')->select(); $node_list = tree_to_list(list_to_tree($node_list, $eq_pid)); $node_list = rotate($node_list); //dump($node_list); $node_list = implode(",", $node_list['id']) . ",{$eq_pid}"; $where['id'] = array('in', $node_list); $menu = $node_model->field('id,pid,name,url')->where($where)->order('sort asc')->select(); $tree = list_to_tree($menu); $this->assign('eq_pid', $eq_pid); $list = tree_to_list($tree); $this->assign('node_list', $list); //$this->assign('menu',sub_tree_menu($list)); $role = M("Role")->order('sort asc')->select(); $this->assign('list', $role); $list = $node_model->where('pid=0')->order('sort asc')->getField('id,name'); $this->assign('groupList', $list); $this->display(); }
public function index() { $widget['date'] = true; $this->assign("widget", $widget); $this->assign('user_id', get_user_id()); $auth = $this->config['auth']; $this->assign('auth', $auth); if ($auth['admin']) { $node = D("Dept"); $dept_id = get_dept_id(); $dept_name = get_dept_name(); $menu = array(); $dept_menu = $node->field('id,pid,name')->where("is_del=0")->order('sort asc')->select(); $dept_tree = list_to_tree($dept_menu, $dept_id); $count = count($dept_tree); if (empty($count)) { /*获取部门列表*/ $html = ''; $html = $html . "<option value='{$dept_id}'>{$dept_name}</option>"; $this->assign('dept_list', $html); /*获取人员列表*/ $where['dept_id'] = array('eq', $dept_id); $emp_list = D("User")->where($where)->getField('id,name'); $this->assign('emp_list', $emp_list); } else { /*获取部门列表*/ $this->assign('dept_list', select_tree_menu($dept_tree)); $dept_list = tree_to_list($dept_tree); $dept_list = rotate($dept_list); $dept_list = $dept_list['id']; /*获取人员列表*/ $where['dept_id'] = array('in', $dept_list); $emp_list = D("User")->where($where)->getField('id,name'); $this->assign('emp_list', $emp_list); } } $map = $this->_search(); if ($auth['admin']) { if (empty($map['dept_id'])) { if (!empty($dept_list)) { $map['dept_id'] = array('in', array_merge($dept_list, array($dept_id))); } else { $map['dept_id'] = array('eq', $dept_id); } } } else { $map['user_id'] = get_user_id(); } if (method_exists($this, '_search_filter')) { $this->_search_filter($map); } $model = D("WorkLog"); if (!empty($model)) { $this->_list($model, $map); } $this->display(); }
function del_tag($tag_id) { $model = M("UserTag"); $tag_list = tree_to_list(list_to_tree($this->get_tag_list("id,pid,name"), $tag_id)); $tag_list = rotate($tag_list); $tag_list = implode(",", $tag_list['id']) . ",{$tag_id}"; $where['id'] = array('in', $tag_list); $this->where($where)->delete(); $this->_del_data_by_tag($tag_list); }
public function get_dept_list($id) { $dept = tree_to_list(list_to_tree(M("Dept")->select(), $id)); $dept = rotate($dept); $dept = implode(",", $dept['id']) . ",{$id}"; $model = M("User"); $where['dept_id'] = array('in', $dept); $data = $model->where($where)->select(); return $data; }
function read() { $id = $_REQUEST['id']; $model = M("Dept"); $dept = tree_to_list(list_to_tree(M("Dept")->where('is_del=0')->select(), $id)); $dept = rotate($dept); $dept = implode(",", $dept['id']) . ",{$id}"; $model = D("UserView"); $where['is_del'] = array('eq', '0'); $where['dept_id'] = array('in', $dept); $data = $model->where($where)->select(); $this->ajaxReturn($data, "", 1); }
protected function _assign_badge_count() { $node_list = D("Node")->access_list(); $system_folder_menu = D("SystemFolder")->get_folder_menu(); $user_folder_menu = D("UserFolder")->get_folder_menu(); $node_list = array_merge($node_list, $system_folder_menu, $user_folder_menu); foreach ($node_list as $val) { $badge_function = $val['badge_function']; if (!empty($badge_function) and function_exists($badge_function) and $badge_function != 'badge_sum') { if ($badge_function == 'badge_count_system_folder' or $badge_function == 'badge_count_user_folder') { $badge_count[$val['id']] = $badge_function($val['fid']); } else { $badge_count[$val['id']] = $badge_function(); } } } //$node_tree = list_to_tree($node_list); foreach ($node_list as $key => $val) { if ($val['badge_function'] == 'badge_sum') { $child_menu = list_to_tree($node_list, $val['id']); $child_menu = tree_to_list($child_menu); //dump($child_menu); $child_menu_id = rotate($child_menu); $count = 0; if (isset($child_menu_id['id'])) { $child_menu_id = $child_menu_id['id']; $count = 0; foreach ($child_menu_id as $k1 => $v1) { if (!empty($badge_count[$v1])) { $count += $badge_count[$v1]; } } } $badge_sum[$val['id']] = $count; } } if (!empty($badge_count)) { if (!empty($badge_sum)) { $total = $badge_count + $badge_sum; } else { $total = $badge_count; } $this->assign('badge_count', $total); } }
private function _check_auth($auth_list) { $arrtmp = explode(';', $auth_list); foreach ($arrtmp as $item) { if (strlen($item) > 2) { if (stripos($item, "dept_") !== false) { $arr_dept = explode('|', $item); $dept_id = substr($arr_dept[1], 5); $emp_list = D("Contact")->get_dept_list($dept_id); $emp_list = rotate($emp_list); if (in_array($_SESSION['emp_no'], $emp_list["emp_no"])) { return true; } } else { if (stripos($item, $_SESSION['emp_no'])) { return true; } } } } return false; }
protected function flow_list() { $user_id = get_user_id(); $model = D('Flow'); //带审批的列表 $FlowLog = M("FlowLog"); $where['emp_no'] = $user_id; $where['_string'] = "result is null"; $log_list = $FlowLog->where($where)->field('flow_id')->select(); if (!empty($log_list)) { $log_list = rotate($log_list); $map['id'] = array('in', $log_list['flow_id']); $todo_flow_list = $model->{$where}($map)->field("id,title,create_time")->select(); $this->assign("todo_flow_list", $todo_flow_list); } //已提交 $map = array(); $map['user_id'] = $user_id; $map['step'] = array('gt', 10); $submit_process_list = $model->where($map)->field("id,title,create_time")->select(); $this->assign("submit_flow_list", $submit_process_list); }
public function get_relation_list($relation, $row_list = null) { if (!empty($relation)) { $where['relation'] = array('eq', $relation); if (!empty($row_list)) { if (is_array($row_list)) { $row_list = array_filter($row_list); } else { $row_list = array_filter(explode(",", $row_list)); } $where['row_id'] = array('in', $row_list); } $list = $this->where($where)->field("row_id,relation_id")->select(); $list = rotate($list); $relation_module = explode("|", $relation); $row_module = $relation_module[0]; $relation_module = $relation_module[1]; $model = M($relation_module); $where['id'] = array('in', $list['relation_id']); $list = $model->where($where)->select(); return $list; } }
function read() { $type = $_REQUEST['type']; $id = $_REQUEST['id']; switch ($type) { case "company": $model = M("Dept"); $dept = tree_to_list(list_to_tree(M("Dept")->where('is_del=0')->select(), $id)); $dept = rotate($dept); $dept = implode(",", $dept['id']) . ",{$id}"; case "emp": $model = M("Dept"); $dept = tree_to_list(list_to_tree(M("Dept")->where('is_del=0')->select(), $id)); $dept = rotate($dept); $dept = implode(",", $dept['id']) . ",{$id}"; $sql = D("UserView")->buildSql(); $model = new Model(); $where['dept_id'] = array('in', $dept); $where['is_del'] = array('eq', 0); $data = $model->table($sql . "a")->where($where)->select(); break; case "rank": $sql = D("UserView")->buildSql(); $model = new Model(); $where['rank_id'] = array('eq', $id); $where['is_del'] = array('eq', 0); $data = $model->table($sql . "a")->where($where)->select(); break; case "position": $sql = D("UserView")->buildSql(); $model = new Model(); $where['position_id'] = array('eq', $id); $where['is_del'] = array('eq', 0); $data = $model->table($sql . "a")->where($where)->select(); break; case "personal": $model = D("UserTag"); if ($id == "#") { $data = $model->get_data_list("Contact"); $data = rotate($data); $data = $data['row_id']; $where['id'] = array('not in', implode(",", $data)); } else { $test = $model; $data = $model->get_data_list("Contact", $id); $data = rotate($data); $data = $data['row_id']; $where['id'] = array('in', implode(",", $data)); } $model = M("Contact"); $where['is_del'] = array('eq', 0); $data = $model->where($where)->field('id,name,position as position_name,email')->select(); //echo $model->getLastSql(); break; default: } $new = array(); if (true) { // 读取成功 $this->ajaxReturn($data, dump($test, false), 1); } }
function get_auth() { $access_list = D("Node")->access_list(); $access_list = array_filter($access_list, array($this, 'filter_module')); $access_list = rotate($access_list); $module_list = $access_list['url']; $module_list = array_map(array($this, "get_module"), $module_list); $module_list = str_replace("_", "", $module_list); $access_list_admin = array_filter(array_combine($module_list, $access_list['admin'])); $access_list_write = array_filter(array_combine($module_list, $access_list['write'])); $access_list_read = array_filter(array_combine($module_list, $access_list['read'])); $module_name = strtolower(MODULE_NAME); $auth['admin'] = array_key_exists($module_name, $access_list_admin) || array_key_exists("##" . $module_name, $access_list_admin); $auth['write'] = array_key_exists($module_name, $access_list_write) || array_key_exists("##" . $module_name, $access_list_write); $auth['read'] = array_key_exists($module_name, $access_list_read) || array_key_exists("##" . $module_name, $access_list_read); if ($auth['admin'] == true) { $auth['write'] = true; } if ($auth['write'] == true) { $auth['read'] = true; } return $auth; }
protected function _assign_group_list() { $model = M("WorkflowType"); $where['group'] = array("neq", ""); $group_list = $model->where($where)->distinct("group")->field("group")->select(); $group_list = rotate($group_list); $group_list = array_combine($group_list["group"], $group_list["group"]); $this->assign("group_list", $group_list); }
/** * Image Rotation * * @return void */ public function autoRotate() { if (!$this->checkPackageRequirements('exif')) { $this->setError(\Lang::txt('You need the PHP exif library installed to rotate image based on Exif Orientation value.')); return false; } if ($this->image_type == IMAGETYPE_JPEG) { $this->exif_data = exif_read_data($this->source); if (isset($this->exif_data['Orientation'])) { switch ($this->exif_data['Orientation']) { case 2: $this->flip(true, false); break; case 3: $this->rotate(180); break; case 4: $this->flip(false, true); break; case 5: $this->rotate(270); $this->flip(true, false); break; case 6: $this->rotate(270); break; case 7: $this - rotate(90); $this->flip(true, false); break; case 8: $this->rotate(90); break; } } } }
private function get_mail_list_by_dept_id($id) { $dept = tree_to_list(list_to_tree(M("Dept")->where('is_del=0')->select(), $id)); $dept = rotate($dept); $dept = implode(",", $dept['id']) . ",{$id}"; $model = M("User"); $where['dept_id'] = array('in', $dept); $where['is_del'] = array('eq', 0); $where['email'] = array('neq', ''); $data = $model->where($where)->select(); return $data; }
die; } if ($argv[1] == "--backup") { backup(); die; } if ($argv[1] == "--conf") { buildconf(); die; } if ($argv[1] == "--restore-id") { restore_id($argv[2]); die; } if ($argv[1] == "--rotate") { rotate($argv[2]); die; } if ($argv[1] == "--tofile") { sargToFile($argv[2]); die; } if ($argv[1] == "--status") { status(); die; } // exec.sarg.php --conf function SargDefault($SargConfig) { if ($SargConfig["report_type"] == null) { $SargConfig["report_type"] = "topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads";
function II(&$A, $B, $C, $D, $M, $s, $t) { $A = hexdec($A); $t = hexdec($t); $M = bindec($M); $A = $A + I($B, $C, $D) + $M + $t & 0xffffffff; //decimal $A = rotate($A, $s); $A = dechex(hexdec($B) + hexdec($A) & 0xffffffff); }
function showSidebar($page, $icons, $planets) { if ($page === 'Registration' || $page === 'Contact') { echo randomize($icons) . '<br /><br /><br />'; echo rotate($planets); } else { echo ""; } }
<?php $heros[] = '<img src="images/coulson.png" />'; $heros[] = '<img src="images/fury.png" />'; $heros[] = '<img src="images/hulk.png" />'; $heros[] = '<img src="images/thor.png" />'; $heros[] = '<img src="images/black-widow.png" />'; $heros[] = '<img src="images/captain-america.png" />'; $heros[] = '<img src="images/machine.png" />'; $heros[] = '<img src="images/iron-man.png" />'; $heros[] = '<img src="images/loki.png" />'; $heros[] = '<img src="images/giant.png" />'; $heros[] = '<img src="images/hawkeye.png" />'; echo randomize($heros); ?> </p> <p>The hero icons come from <a href="http://icongal.com/gallery/iconset/2503/avengers_superhero_avatar" target="_blank">here</a></p> <h3>Daily Planet</h3> <p>Uses <b>rotate()</b> function and an array named <b>$planets</b> from an include file to display a different planet and astrological info for each day.</p> <p> There are 8 planets in the array, so after 8 days the planets start again from the beginning. </p> <p> <?php echo rotate($planets); ?> </p> </body> </html>
public function mine() { $widget['date-range'] = true; $this->assign("widget", $widget); $this->assign('user_id', get_user_id()); $this->assign("title", '日志查询'); $auth = $this->config['auth']; $this->assign('auth', $auth); if ($_GET['id']) { $id = $_GET['id']; $this->assign("XIN", 0); } else { $id = get_user_id(); $this->assign("XIN", 1); } if ($auth['admin']) { $rolein = false; $role = D('role_user')->where('user_id = ' . get_user_id())->field('role_id')->select(); for ($i = 0; $i < count($role); $i++) { if ($role[$i]['role_id'] == 1 || $role[$i]['role_id'] == 12) { $rolein = true; continue; } } $node = D("Dept"); $dept_id = get_dept_id(); $dept_name = get_dept_name(); $menu = array(); $dept_menu = $node->field('id,pid,name')->where("is_del=0")->order('sort asc')->select(); if ($rolein) { $dept_tree = list_to_tree($dept_menu); } else { $dept_tree = list_to_tree($dept_menu, $dept_id); } $count = count($dept_tree); // dump(get_user_id()); // exit; if (empty($count)) { /*获取部门列表*/ $html = ''; $html = $html . "<option value='{$dept_id}'>{$dept_name}</option>"; $this->assign('dept_list', $html); /*获取人员列表*/ $where['dept_id'] = array('eq', $dept_id); $emp_list = D("User")->where($where)->getField('id,emp_name'); // $this->assign('emp_list',$emp_list); } else { /*获取部门列表*/ $this->assign('dept_list', select_tree_menu($dept_tree)); $dept_list = tree_to_list($dept_tree); $dept_list = rotate($dept_list); $dept_list = $dept_list['id']; /*获取人员列表*/ $where['dept_id'] = array('in', $dept_list); $emp_list = D("User")->where($where)->getField('id,emp_name'); // $this->assign('emp_list',$emp_list); } } $map = $this->_search(); $map['user_id'] = $id; if (method_exists($this, '_search_filter')) { $this->_search_filter($map); } $model = D("WorkLog"); if (!empty($model)) { $this->_list($model, $map); // $this -> _list($model,''); } $this->assign("uid", $id); $this->display(); }
/** 确认是否有权限进入相应的菜单 +---------------------------------------------------------- */ protected function _check_node_auth() { $access_list = session('menu' . get_user_id()); $access_list = rotate($access_list); $access_list = $access_list['url']; $access_list = array_map("get_module", $access_list); $access_list = array_unique($access_list); $access_list = array_filter($access_list); $public_list = explode(",", C('NOT_AUTH_MODULE')); if (in_array(MODULE_NAME, $public_list)) { return true; } else { $result = in_array(strtolower(MODULE_NAME), $access_list); } return $result; }
function _flow_auth_filter($folder, &$map) { $emp_no = get_emp_no(); $user_id = get_user_id(); switch ($folder) { case 'confirm': $this->assign("folder_name", '待办'); $FlowLog = M("FlowLog"); $where['emp_no'] = $emp_no; $where['_string'] = "result is null"; $log_list = $FlowLog->where($where)->field('flow_id')->select(); $log_list = rotate($log_list); if (!empty($log_list)) { $map['id'] = array('in', $log_list['flow_id']); } else { $map['_string'] = '1=2'; } break; case 'darft': $this->assign("folder_name", '草稿'); $map['user_id'] = $user_id; $map['step'] = 10; break; case 'submit': $this->assign("folder_name", '提交'); $map['user_id'] = array('eq', $user_id); $map['step'] = array(array('gt', 10), array('eq', 0), 'or'); break; case 'finish': $this->assign("folder_name", '办理'); $FlowLog = M("FlowLog"); $where['emp_no'] = $emp_no; $where['_string'] = "result is not null"; $log_list = $FlowLog->where($where)->field('flow_id')->select(); $log_list = rotate($log_list); if (!empty($log_list)) { $map['id'] = array('in', $log_list['flow_id']); } else { $map['_string'] = '1=2'; } break; case 'receive': $this->assign("folder_name", '收到'); $FlowLog = M("FlowLog"); $where['emp_no'] = $emp_no; $where['step'] = 100; $log_list = $FlowLog->where($where)->field('flow_id')->select(); $log_list = rotate($log_list); if (!empty($log_list)) { $map['id'] = array('in', $log_list['flow_id']); } else { $map['_string'] = '1=2'; } break; case 'report': $this->assign("folder_name", '统计报告'); $role_list = D("Role")->get_role_list($user_id); $role_list = rotate($role_list); $role_list = $role_list['role_id']; $duty_list = D("Role")->get_duty_list($role_list); $duty_list = rotate($duty_list); $duty_list = $duty_list['duty_id']; if (!empty($duty_list)) { $map['report_duty'] = array('in', $duty_list); $map['step'] = array('gt', 10); } else { $this->error("没有权限"); } break; } }
function status() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pidTime = "/usr/share/artica-postfix/ressources/logs/web/nginx.status.acl"; if (!$GLOBALS["FORCE"]) { if ($unix->file_time_min($pidTime) < 5) { return; } } $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); return; } @file_put_contents($pidfile, getmypid()); caches_status(); @unlink($pidTime); @mkdir("/usr/share/artica-postfix/ressources/logs/web", 0777, true); @file_put_contents($pidTime, time()); @chmod($pidTime, 0777); rotate(); }
function _conv_confirm($key, $val) { $arr_confirm = explode("|", $val); $str_confirm; array_pop($arr_confirm); foreach ($arr_confirm as $confirm) { if (strpos($confirm, "dgp") !== false) { $temp = explode("_", $confirm); $dept_grade = $temp[1]; $position = $temp[2]; $dept_id = $this->_get_dept($_SESSION['dept_id'], $dept_grade); $model = M("User"); $where = array(); $where['dept_id'] = $dept_id; $where['position_id'] = $position; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); //dump($emp_list); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_confirm .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($confirm, "dp") !== false) { $temp = explode("_", $confirm); $dept = $temp[1]; $position = $temp[2]; $model = M("User"); $where = array(); $where['dept_id'] = $dept; $where['position_id'] = $position; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); //dump($emp_list); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_confirm .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($confirm, "dept") !== false) { $temp = explode("_", $confirm); $dept = $temp[1]; $model = M("User"); $where = array(); $where['dept_id'] = $dept; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_confirm .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($confirm, "emp") !== false) { $temp = explode("_", $confirm); $emp = $temp[1]; $str_confirm .= $emp . "|"; } if (strpos($confirm, "_") == false) { $str_confirm .= $confirm . "|"; } } $model = M("Flow"); $model->where("id={$key}")->setField('confirm', $str_confirm); return $str_confirm; }
private function _check_auth($auth_list) { $arrtmp = array_filter(explode(';', $auth_list)); foreach ($arrtmp as $item) { if (stripos($item, "dept_") !== false) { $arr_dept = explode('|', $item); $dept_id = substr($arr_dept[1], 5); $emp_list = $this->get_emp_list_by_dept_id($dept_id); $emp_list = rotate($emp_list); $emp_list = $emp_list['emp_no']; //dump($emp_list); if (in_array(get_emp_no(), $emp_list)) { return true; } } else { if (stripos($item, get_emp_no()) !== false) { return true; } } } return false; }
function check_duty($duty_no, $user_id = null) { if (empty($user_id)) { $user_id = get_user_id(); } $role_list = $this->get_role_list($user_id); $role_list = rotate($role_list); $role_list = $role_list['role_id']; $duty_list = $this->get_duty_list($role_list); $duty_list = rotate($duty_list); $duty_list = $duty_list['duty_id']; $where_duty_id['duty_no'] = array('eq', $duty_no); $show_log_duty_id = M("Duty")->where($where_duty_id)->getField('id'); if (in_array($show_log_duty_id, $duty_list)) { return true; } else { return false; } }
} if ($argv[1] == "--restart") { $GLOBALS["OUTPUT"] = true; restart(); @unlink($GLOBALS["CACHE_IHM"]); die; } if ($argv[1] == "--reload") { $GLOBALS["OUTPUT"] = true; reload(); @unlink($GLOBALS["CACHE_IHM"]); die; } if ($argv[1] == "--rotatelog") { $GLOBALS["OUTPUT"] = true; rotate(); die; } if ($argv[1] == "--force-restart-squid") { $GLOBALS["OUTPUT"] = true; force_restart_squid(); die; } function restart() { $unix = new unix(); $FORCED_TEXT = null; $NOTIFY = false; $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) {
function get_new_count() { $emp_no = get_emp_no(); //获取未读邮件 $data = array(); $user_id = get_user_id(); $where['user_id'] = $user_id; $where['is_del'] = array('eq', '0'); $where['folder'] = array('eq', 1); $where['read'] = array('eq', '0'); $new_mail_inbox = M("Mail")->where($where)->count(); $data['bc-mail']['bc-mail-inbox'] = $new_mail_inbox; //获取未读邮件 $where['user_id'] = $user_id; $where['is_del'] = array('eq', '0'); $where['folder'] = array('gt', 6); $where['read'] = array('eq', '0'); $new_mail_myfolder = M("Mail")->where($where)->count(); $data['bc-mail']['bc-mail-myfolder'] = $new_mail_myfolder; //获取待裁决 $where = array(); $FlowLog = M("FlowLog"); $where['emp_no'] = $emp_no; $where['_string'] = "result is null"; $log_list = $FlowLog->where($where)->field('flow_id')->select(); $log_list = rotate($log_list); $new_confirm_count = 0; if (!empty($log_list)) { $map['id'] = array('in', $log_list['flow_id']); $new_confirm_count = M("Flow")->where($map)->count(); } $data['bc-flow']['bc-flow-confirm'] = $new_confirm_count; //获取收到的流程 $where = array(); $where['emp_no'] = $emp_no; $where['step'] = 100; $where['is_read'] = 1; $log_list = M("FlowLog")->where($where)->field('flow_id')->select(); $log_list = rotate($log_list); $new_receive_count = 0; if (!empty($log_list)) { $map['id'] = array('in', $log_list['flow_id']); $new_receive_count = M("Flow")->where($map)->count(); } $data['bc-flow']['bc-flow-receive'] = $new_receive_count; //获取最新通知 $where = array(); $where['is_del'] = array('eq', '0'); $folder_list = D("SystemFolder")->get_authed_folder(get_user_id(), "NoticeFolder"); $where['folder'] = array('in', $folder_list); $where['create_time'] = array("egt", time() - 3600 * 24 * 30); $readed = array_filter(explode(",", get_user_config("readed_notice"))); $where['id'] = array("not in", $readed); $new_notice_count = M('Notice')->where($where)->count(); $data['bc-notice']['bc-notice-new'] = $new_notice_count; //获取待办事项 $where = array(); $where['user_id'] = $user_id; $where['status'] = array("in", "1,2"); $new_todo_count = M("Todo")->where($where)->count(); $data['bc-personal']['bc-personal-todo'] = $new_todo_count; //获取日程事项 $where = array(); $where['user_id'] = $user_id; $where['start_date'] = array("elt", date("Y-m-d")); $where['end_date'] = array("egt", date("Y-m-d")); $new_schedule_count = M("Schedule")->where($where)->count(); $data['bc-personal']['bc-personal-schedule'] = $new_schedule_count; //获取最新消息 $model = M("Message"); $where = array(); $where['owner_id'] = $user_id; $where['receiver_id'] = $user_id; $where['is_read'] = array('eq', '0'); $new_message_count = M("Message")->where($where)->count(); $data['bc-message']['bc-message-new'] = $new_message_count; //等我接受的任务 $where = array(); $where_log['type'] = 1; $where_log['status'] = 0; $where_log['executor'] = get_user_id(); $task_list = M("TaskLog")->where($where_log)->getField('task_id id,task_id'); $where['id'] = array('in', $task_list); $task_todo_count = M("Task")->where($where)->count(); $data['bc-task']['task_todo_count'] = $task_todo_count; //我部门任务 $where = array(); $auth = D("Role")->get_auth("Task"); if ($auth['admin']) { $where_log['type'] = 2; $where_log['executor'] = get_dept_id(); $task_list = M("TaskLog")->where($where_log)->getField('task_id id,task_id'); $where['id'] = array('in', $task_list); } else { $where['_string'] = '1=2'; } $task_dept_count = M("Task")->where($where)->count(); $data['bc-task']['task_dept_count'] = $task_dept_count; return $data; }
function _conv_auditor($val) { $arr_auditor = array_filter(explode("|", $val)); $str_auditor; foreach ($arr_auditor as $auditor) { if (strpos($auditor, "dgp") !== false) { $temp = explode("_", $auditor); $dept_grade = $temp[1]; $position = $temp[2]; $dept_id = $this->_get_dept(get_dept_id(), $dept_grade); $model = M("User"); $where = array(); $where['dept_id'] = $dept_id; $where['position_id'] = $position; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_auditor .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($auditor, "dp") !== false) { $temp = explode("_", $auditor); $dept = $temp[1]; $position = $temp[2]; $model = M("User"); $where = array(); $where['dept_id'] = $dept; $where['position_id'] = $position; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_auditor .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($auditor, "dept") !== false) { $temp = explode("_", $auditor); $dept = $temp[1]; $model = M("User"); $where = array(); $where['dept_id'] = $dept; $where['is_del'] = 0; $emp_list = $model->where($where)->select(); $emp_list = rotate($emp_list); if (!empty($emp_list)) { $str_auditor .= implode(",", $emp_list['emp_no']) . "|"; } } if (strpos($auditor, "emp") !== false) { $temp = explode("_", $auditor); $emp = $temp[1]; $str_auditor .= $emp . "|"; } if (strpos($val, "_") == false) { $str_auditor .= $val . "|"; } } return $str_auditor; }
function status() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pidTime = "/usr/share/artica-postfix/ressources/logs/web/nginx.status.acl"; if (!$GLOBALS["FORCE"]) { if ($unix->file_time_min($pidTime) < 5) { return; } } $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); return; } @file_put_contents($pidfile, getmypid()); $maindir = "/etc/nginx/sites-enabled"; foreach (glob("/etc/nginx/sites-enabled/*") as $filename) { $t = explode("\n", @file_get_contents($filename)); while (list($key, $line) = each($t)) { if (preg_match("#listen\\s+(.+?);#", $line, $re)) { $array[basename($filename)]["LISTEN"] = $re[1]; continue; } if (preg_match("#server_name\\s+(.+?);#", $line, $re)) { $re[1] = trim($re[1]); if (preg_match("#^(.+?)\\s+#", $re[1], $ri)) { $re[1] = $ri[1]; } $array[basename($filename)]["host"] = $re[1]; continue; } if (preg_match("#ssl\\s+on;#", $line, $re)) { $array[basename($filename)]["SSL"] = true; continue; } } } $curl = $unix->find_program("curl"); while (list($key, $BIG) = each($array)) { $f = array(); if ($GLOBALS["VERBOSE"]) { echo "{$BIG["host"]}\n"; } if (preg_match("#unix:#", $BIG["LISTEN"])) { continue; } $proto = "http"; $f[] = "{$curl}"; $f[] = "--header 'Host: {$BIG["host"]}'"; if (isset($BIG["SSL"])) { $f[] = "--insecure"; $proto = "https"; } $f[] = "{$proto}://127.0.0.1:{$BIG["LISTEN"]}/nginx_status 2>&1"; $cmdline = @implode(" ", $f); if ($GLOBALS["VERBOSE"]) { echo "{$cmdline}\n"; } $results = array(); exec("{$cmdline}", $results); while (list($index, $line) = each($results)) { if (preg_match("#Active connections:\\s+([0-9]+)#", $line, $re)) { $FINAL[$BIG["host"]]["AC"] = $re[1]; continue; } if (preg_match("#([0-9]+)\\s+([0-9]+)\\s+([0-9]+)#", $line, $re)) { $FINAL[$BIG["host"]]["ACCP"] = $re[1]; $FINAL[$BIG["host"]]["ACHDL"] = $re[2]; $FINAL[$BIG["host"]]["ACRAQS"] = $re[3]; continue; } if (preg_match("#Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)#", $line, $re)) { $FINAL[$BIG["host"]]["reading"] = $re[1]; $FINAL[$BIG["host"]]["writing"] = $re[2]; $FINAL[$BIG["host"]]["waiting"] = $re[3]; continue; } } } if ($GLOBALS["VERBOSE"]) { print_r($FINAL) . "\n"; } caches_status(); @unlink($pidTime); @mkdir("/usr/share/artica-postfix/ressources/logs/web", 0777, true); @file_put_contents($pidTime, serialize($FINAL)); @chmod($pidTime, 0777); rotate(); }
//this allows us to add unique info to our pages switch (THIS_PAGE) { /*case "template.php": $title = "My Template Title Tag"; $pageID = "My Template Page ID"; //$headerImage = "diner-girl.jpg"; $headerImage = "waitress.png"; $widget = randomize($heros); break;*/ case "daily.php": $title = "Daily Special!"; $pageID = "Daily Special"; //$headerImage = "Waitress2.jpg"; $headerImage = "waitress.png"; $widget = rotate($planets); break; case "index.php": $title = "Home Page"; $pageID = "Welcome to the Retro Diner Home Page!"; $headerImage = "waitress.png"; //$widget = ''; $widget = randomize($heros); break; case "contact.php": $title = "Contact Page"; $pageID = "Contact Page"; //$headerImage = "fries2.jpg"; $headerImage = "waitress.png"; $widget = ''; break;