/** * 处理sphinx的返回结果 */ private function prepareSphinxResult($result) { if (!isset($result['matches'])) { return false; } $result = arraySort($result['matches'], 'weight', 'desc'); $articleIds = []; foreach ($result as $key => $value) { $articleIds[] = $value['attrs']['article_id']; } return $articleIds; }
/** * Function to get the contacts through the master id & user id * * @param session vars * * @param user_id (int) * */ function contacts($credentials, $user_id) { $this->db->select('users.id as u_id, users.first_name, users.last_name, users.title, users.type, contact.*, address.*, counties.region')->from($this->users)->where($credentials)->where('type > ', 0)->where_not_in($this->users . '.id', $user_id)->join('contact', 'contact.id = users.contact_id', 'left')->join('address', 'address.id = users.address_id', 'left')->join('counties', 'address.county = counties.id', 'left')->order_by('users.type ASC, users.first_name ASC'); $q = $this->db->get(); if ($q->num_rows() > 0) { if (array_key_exists('type', $credentials)) { return $q->result_array(); } else { return arraySort($q->result_array(), 'type'); } } else { return false; } }
function get_all($table, $distinct = NULL, $sortkey = NULL) { $this->db->select('*'); if ($distinct != NULL) { $this->db->group_by($distinct)->distinct()->select($distinct)->order_by($sortkey . ' ASC')->order_by($distinct . ' ASC'); } $q = $this->db->get($table); if ($q->num_rows() > 0) { foreach ($q->result() as $row) { $data[] = $row; } return $sortkey == NULL ? $data : arraySort($q->result_array(), $sortkey); } return FALSE; }
function file_folder($folder, $types = false) { global $_josh; error_debug("<b>file folder</b> running with {$folder}"); if (!is_dir($folder)) { error_debug("<b>file folder</b> {$folder} is not a directory"); $folder = $_josh["root"] . $folder; if (!is_dir(!$folder)) { error_debug("<b>file folder</b> {$folder} is not a directory either, exiting"); return false; } } error_debug("<b>file folder</b> {$folder} is a directory!"); if ($types) { $types = explode(",", $types); } if ($handle = opendir($folder)) { error_debug("<b>file folder</b> {$folder} opened"); $return = array(); while (($name = readdir($handle)) !== false) { if ($name == "." || $name == ".." || $name == ".DS_Store") { continue; } $nameparts = explode(".", $name); $thisfile = array("name" => $name, "ext" => $nameparts[count($nameparts) - 1], "path_name" => $folder . $name, "type" => filetype($folder . $name), "fmod" => filemtime($folder . $name), "size" => filesize($folder . $name)); if ($thisfile["type"] == "dir") { $thisfile["path_name"] .= "/"; } error_debug("<b>file folder</b> found " . $thisfile["name"] . " of type " . $thisfile["type"]); if ($types) { $oneFound = false; foreach ($types as $type) { if ($thisfile["ext"] == trim($type) || $type == "dir" && $thisfile["type"] == "dir") { $oneFound = true; } } if ($oneFound) { $return[] = $thisfile; } } else { $return[] = $thisfile; } } error_debug("<b>file folder</b> closing handle"); closedir($handle); if (count($return)) { return arraySort($return); } error_debug("<b>file folder</b> no return count"); } return false; }
<?php echo sprintf($this->lang->line('tag_heading'), 'Quality Audit History'); if (is_array($history)) { echo "<br><br>"; echo "<div role=\"tabpanel\">"; echo "<ul class=\"nav nav-tabs\" role=\"tablist\">"; for ($i = 0; $i < count($tabheaders); $i++) { $id = strtolower(str_replace(' ', '', $tabheaders[$i])); echo "<li role=\"presentation\" class=\"" . ($i == 0 ? 'active' : NULL) . "\"><a href=\"#" . $id . "\" aria-controls=\"" . $id . "\" role=\"tab\" data-toggle=\"tab\">" . $tabheaders[$i] . "</a></li>"; } echo "</ul>"; echo "<div class=\"tab-content\">\n"; $i = 0; foreach (arraySort($history, 'spec_name') as $name => $qas) { $id = strtolower(str_replace(' ', '', $name)); echo "<div role=\"tabpanel\" class=\"tab-pane " . ($i == 0 ? 'active' : NULL) . " \" id=\"" . $id . "\"><br>\r\n\t\t\t\r\n\t\t\t\t\t\t<h3>" . $name . "</h3>"; $this->load->view($modules . 'qa_history', array('qas' => $qas)); echo "</div>"; $i++; } echo "</div>"; echo "</div>"; } ?>
if ($db_tlist) { $tlistdb = $db_tlist; $current_tlist = current($tlistdb); $tidmax = $current_tlist[1]; } else { $tlistdb = array(); $tidmax = 0; } $tlistdb = (array) $tlistdb; @extract($db->get_one("SELECT MAX(tid) AS tid FROM pw_threads")); $tidmax = max($tidmax, $tid); $tlistdb[$num] = array(1 => $tidmax + 100, 2 => ''); if (count($tlistdb) == 1) { $tlistdb[0] = array(1 => '', 2 => ''); } $tlistdb = arraySort($tlistdb, 1); $db_tlist = $tlistdb; setConfig('db_tlist', $db_tlist); } else { $i = 0; $plistdb = is_array($db_plist) ? $db_plist : array(); $plistdb['0'] = $plistdb['0'] ? $plistdb['0'] : ''; $plist = array(0 => $plistdb['0']); $query = $db->query("SHOW TABLE STATUS LIKE 'pw_posts%'"); while ($rs = $db->fetch_array($query)) { $j = str_replace($PW . 'posts', '', $rs['Name']); if ($j && !is_numeric($j)) { continue; } $i++; if ($j) {
public function job_times() { if (!empty($this->posts)) { $this->get_staff(); $data = arraySort($this->data['staff'], 'staff_id'); $this->data['selectedStaff'] = array(); foreach ($this->posts['staff_ids'] as $staff_id) { $this->data['selectedStaff'][] = $data[$staff_id]; } $this->load->view($this->data['modules'] . 'selectedStaff', $this->data); } return false; }
} unset($targetContent[$pageName][$key]); } } } reset($targetContent); foreach ($targetContent as $pageName => $page) { foreach ($page as $key => $value) { fwrite($stderr, 'TO_REMOVE - added : ' . $pageName . ' ' . $key . "\n"); $resultContent[$pageName][$key] = array('value' => $value['value'], 'prefix' => TO_REMOVE); } } fclose($stderr); unset($targetContent); unset($baseContent); arraySort($resultContent); reset($resultContent); foreach ($resultContent as $pageName => $page) { foreach ($page as $key => $value) { echo $value['prefix'] . $pageName . "\t" . $key . "\t" . $value['value'] . "\n"; } } function showHelp() { global $argc, $argv; $self = basename($argv[0]); ?> >> GForge language file merge utility, by Hunte Swee<*****@*****.**> and Guillaume Smet<*****@*****.**><< Usage: <?php