function is_consistency($arr_of_parse, $arr_of_result) { if (array_key_exists('empty', $arr_of_result)) { if ($arr_of_parse["msg"] == "no matched pattern") { return true; } else { return false; } } else { if ($arr_of_parse["code"] == "100") { $arr = array(); if (isset($arr_of_parse["global"])) { $arr = $arr_of_parse["global"]; } //获取解析后的数据信息 foreach ($arr as $key => $value) { $val = int(float($value)); if (int($arr_of_result[$key]) != $val) { return false; } } return true; } else { return false; } } }
public static function getlist($job_id = null, $output = null, $page = 0, $size = 20) { $page = int($page); $size = int($size); if ($size > 100) { $size = 100; } $sql = 'select * from wm_jobs_history '; $cond = ''; $params = []; if ($job_id !== null) { if (!empty($cond)) { $cond += ' and '; } $cond += 'job_id = :job_id'; $params[':job_id'] = $job_id; } if ($output !== null) { if (!empty($cond)) { $cond += ' and '; } $cond += 'output = :output'; $params[':output'] = $output; } $sql += ' where ' + $cond + ' limit ' + $page * $size + ',' + $size; return JobHistoryModel::findBySql($sql, $params) . all(); }
public function paginate($page, $per_page = 20, $where = '') { $page = abs(int($page)) - 1; $skip = ($page - 1) * $per_page; $sql = "SELECT * FROM `{$this->table}` {$where} LIMIT {$per_page} OFFSET {$skip}"; return db_get_all($sql); }
function UploadImageSlots() { global $ImageSlots; global $ImageParameters; foreach ($ImageSlots as $sl => $slot) { $img; if (isset($_FILES['upload_image_slot_' . $sl]['tmp_name'])) { $img = imagecreatefromjpeg($_FILES['upload_image_slot_' . $sl]['tmp_name']); } elseif (isset($_FILES['url_image_slot_' . $sl]) && $_FILES['url_image_slot_' . $sl] != '') { $img = imagecreatefromjpeg($_FILES['url_image_slot_' . $sl]); } if ($img) { $wd = imagesx($img); $ht = imagesy($img); foreach ($slot['images'] as $ikey) { $ipar = $ImageParameters[$ikey]; $wd2 = $ipar['width']; $ht2 = $ipar['height']; $sc = min($wd2 / $wd, $ht2 / $ht); $img2 = imagecreatetruecolor($wd2, $ht2); imagecopyresized($img2, $img, int(($wd2 - $wd * $sc + 1) / 2), int(($ht2 - $ht * $sc + 1) / 2), 0, 0, int($wd * $sc + 0.5), int($ht * $sc + 0.5), $wd, $ht); $dir = DIR_FS_CATALOG_IMAGES . $ikey . '/'; mkdir($dir, 0755); imagejpeg($img2, $dir . $img_filename, isset($ipar['quality']) ? $ipar['quality'] : 75); } } } }
static function colname($col) { if ($col < 26) { return chr($col + 65); } else { $x = int($col / 26); return chr($x + 65) . chr($col % 26 + 65); } }
function safeid($v) { if (strstr($v, ",")) { $arr = explode(',', $v); foreach ($arr as $val) { $value[] = (int) $val; } $v = implode(',', $value); } elseif (is_array($v)) { foreach ($v as $val) { $value[] = (int) $val; } $v = $value; } else { $v = int($v); } return $v; }
function create_job($ticket, $values) { $CI =& get_instance(); $product = $ticket['product']; $to = $values['to']; $agent = get_user_by_id($ticket['agent']); $price = get_price($product['id'], $agent['level']); if (!change_credit($agent['id'], -$price, $ticket['number'])) { return 'INSUFFICIENT_BALANCE_FROM_AGENT'; } if ($product['cate'] == 4) { $this->load->helper('user'); $user = get_user(); if (!$user) { return 'LOGIN_REQUIRED'; } // hack self business here if ($product['subcate'] == 900) { // increase balance change_credit($user['id'], $product['norm_value'], $ticket['number']); } if ($product['subcate'] == 910) { // upgrade agent $from = $product['province'] % 10; $to = int($product['province'] / 10); if ($user['level'] != $from) { return 'INVALID_CURRENT_LEVEL'; } if ($user['parent'] && $user['parent'] != $ticket['agent']) { return 'PARENT_CONFLICTED'; } $this->db->update('agent', array('level' => $to, 'parent' => $ticket['agent']), array('name' => $username)); } } else { $this->db->insert('job', array('create_time' => time(), 'commit_time' => 0, 'ticket_number' => $ticket['number'], 'to' => $values['to'], 'area' => $values['area'], 'product_id' => $product['id'], 'locking_on' => NULL, 'retried' => 0, 'result' => 0, 'reason' => NULL)); } return 'SUCCESS'; }
function get_last_release() { $result = sql_do('SELECT id_rel FROM releases WHERE date_rel like (SELECT max(date_rel) FROM releases) AND id_branch=\'' . int($this->get_id_branch()) . '\''); if ($result->numRows() == 0) { return 0; } else { $row = $result->fetchRow(); return $row[0]; } }
function nxs_ogtgCallback($content) { global $post, $plgn_NS_SNAutoPoster; if (stripos($content, 'og:title') !== false) { $ogOut = "\r\n"; } else { if (!isset($plgn_NS_SNAutoPoster)) { $options = get_option('NS_SNAutoPoster'); } else { $options = $plgn_NS_SNAutoPoster->nxs_options; } $ogimgs = array(); if (!empty($post) && !is_object($post) && int($post) > 0) { $post = get_post($post); } if (empty($options['advFindOGImg'])) { $options['advFindOGImg'] = 0; } $title = preg_match('/<title>(.*)<\\/title>/', $content, $title_matches); if ($title !== false && count($title_matches) == 2) { $ogT = '<meta property="og:title" content="' . $title_matches[1] . '" />' . "\r\n"; } else { if (is_home() || is_front_page()) { $ogT = get_bloginfo('name'); } else { $ogT = get_the_title(); } $ogT = '<meta property="og:title" content="' . esc_attr(apply_filters('nxsog_title', $ogT)) . '" />' . "\r\n"; } $prcRes = preg_match('/<meta name="description" content="(.*)"/', $content, $description_matches); if ($prcRes !== false && count($description_matches) == 2) { $ogD = '<meta property="og:description" content="' . $description_matches[1] . '" />' . "\r\n"; } if (!empty($post) && is_object($post) && is_singular()) { if (has_excerpt($post->ID)) { $ogD = strip_tags(nxs_snapCleanHTML(get_the_excerpt($post->ID))); } else { $ogD = str_replace(" ", ' ', str_replace("\r\n", ' ', trim(substr(strip_tags(nxs_snapCleanHTML(strip_shortcodes($post->post_content))), 0, 200)))); } } else { $ogD = get_bloginfo('description'); } $ogD = preg_replace('/\\r\\n|\\r|\\n/m', '', $ogD); $ogD = '<meta property="og:description" content="' . esc_attr(apply_filters('nxsog_desc', $ogD)) . '" />' . "\r\n"; $ogSN = '<meta property="og:site_name" content="' . get_bloginfo('name') . '" />' . "\r\n"; $ogLoc = strtolower(esc_attr(get_locale())); if (strlen($ogLoc) == 2) { $ogLoc .= "_" . strtoupper($ogLoc); } $ogLoc = '<meta property="og:locale" content="' . $ogLoc . '" />' . "\r\n"; $iss = is_home(); $ogType = is_singular() ? 'article' : 'website'; if (empty($vidsFromPost)) { $ogType = '<meta property="og:type" content="' . esc_attr(apply_filters('nxsog_type', $ogType)) . '" />' . "\r\n"; } if (is_home() || is_front_page()) { $ogUrl = get_bloginfo('url'); } else { $ogUrl = 'http' . (is_ssl() ? 's' : '') . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } $ogUrl = '<meta property="og:url" content="' . esc_url(apply_filters('nxsog_url', $ogUrl)) . '" />' . "\r\n"; if (!is_home()) { /* $vidsFromPost = nsFindVidsInPost($post); if ($vidsFromPost !== false && is_singular()) { echo '<meta property="og:video" content="http://www.youtube.com/v/'.$vidsFromPost[0].'" />'."\n"; echo '<meta property="og:video:type" content="application/x-shockwave-flash" />'."\n"; echo '<meta property="og:video:width" content="480" />'."\n"; echo '<meta property="og:video:height" content="360" />'."\n"; echo '<meta property="og:image" content="http://i2.ytimg.com/vi/'.$vidsFromPost[0].'/mqdefault.jpg" />'."\n"; echo '<meta property="og:type" content="video" />'."\n"; } */ if (is_object($post)) { $imgURL = nxs_getPostImage($post->ID, 'full', $options['ogImgDef']); if (!empty($imgURL)) { $ogimgs[] = $imgURL; } $imgsFromPost = nsFindImgsInPost($post, (int) $options['advFindOGImg'] == 1); if ($imgsFromPost !== false && is_singular() && is_array($ogimgs) && is_array($imgsFromPost)) { $ogimgs = array_merge($ogimgs, $imgsFromPost); } } } //## Add default image to the endof the array if (count($ogimgs) < 1 && isset($options['ogImgDef']) && $options['ogImgDef'] != '') { $ogimgs[] = $options['ogImgDef']; } //## Output og:image tags $ogImgsOut = ''; if (!empty($ogimgs) && is_array($ogimgs)) { foreach ($ogimgs as $ogimage) { $ogImgsOut .= '<meta property="og:image" content="' . esc_url(apply_filters('ns_ogimage', $ogimage)) . '" />' . "\r\n"; } } $ogOut = "\r\n" . $ogSN . $ogT . $ogD . $ogType . $ogUrl . $ogLoc . $ogImgsOut; } $content = str_ireplace('<!-- ## NXSOGTAGS ## -->', $ogOut, $content); return $content; }
function get_last_release() { $result = sql_do('SELECT id_rel FROM ' . DB_PREF . '_releases JOIN ' . DB_PREF . '_branches USING (id_branch) JOIN ' . DB_PREF . '_projects USING (id_prj) WHERE ' . DB_PREF . '_branches.id_branch=' . DB_PREF . '_projects.default_branch AND ' . DB_PREF . '_projects.id_prj=\'' . int($this->get_id_prj()) . '\' ORDER BY date_rel DESC LIMIT 1'); if ($result->numRows() == 0) { return 0; } else { $row = $result->fetchRow(); return $row[0]; } }
/** * volume_set * This isn't a required function, it sets the volume to a specified value * as passed in the variable it is a 0 - 100 scale the controller is * responsible for adjusting the scale if nessecary */ public function volume_set($value) { /* Make sure it's int and 0 - 100 */ $value = int($value); /* Make sure that it's between 0 and 100 */ if ($value > 100 or $value < 0) { return false; } if (!$this->_player->volume($value)) { debug_event('localplay', 'Error: Unable to set volume, check ' . $this->type . ' controller', '1'); return false; } return true; }
function _write_url_internal() { $_ = func_get_args(); $record = 0x1b8; # Record identifier $length = 0x0; # Bytes to follow $row1 = $_[0]; # Start row $col1 = $_[1]; # Start column $row2 = $_[2]; # End row $col2 = $_[3]; # End column $url = $_[4]; # URL string if (isset($_[5])) { $str = $_[5]; # Alternative label } $xf = $_[6] ? $_[6] : $this->_url_format; # The cell format # Strip URL type $url = preg_replace('s[^internal:]', '', $url); # Write the visible label if (!isset($str)) { $str = $url; } $str_error = $this->write_string($row1, $col1, $str, $xf); if ($str_error == -2) { return $str_error; } # Pack the undocumented parts of the hyperlink stream $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000"); # Pack the option flags $options = pack("V", 0x8); # Convert the URL type and to a null terminated wchar string $url = join("", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY)); $url = $url . ""; # Pack the length of the URL as chars (not wchars) $url_len = pack("V", int(strlen($url) / 2)); # Calculate the data length $length = 0x24 + strlen($url); # Pack the header data $header = pack("vv", $record, $length); $data = pack("vvvv", $row1, $row2, $col1, $col2); # Write the packed data $this->_append($header . $data . $unknown1 . $options . $url_len . $url); return $str_error; }
/** * 删除我的购物车的东西 * * @author kylin <*****@*****.**> * @param maxed $aid * @access public * @return JSON */ public function delCart() { $idArr = I('get.aid'); $model = M('ad_carts'); $uid = session('userID'); $where['uid'] = $uid; if (is_array($idArr)) { $where['aid'] = array('in', $idArr); } else { $where['aid'] = int($idArr); } $res = $model->where($where)->delete(); if ($res !== false) { $status = true; } else { $status = false; } $this->ajaxReturn($status, 'json'); }
public function updateGroup($id, $group_id) { global $webdb; $webdb->query("UPDATE " . $this->tableName . " SET group_id = '" . int($group_id) . "' WHERE id = '" . (int) $id . "'"); }
function get_last_release() { $result = sql_do('select id_rel from releases join branches using (id_branch) join projects using (id_prj) where id_branch=default_branch and id_prj=\'' . int($this->get_id_prj()) . '\' order by date_rel desc limit 1'); if ($result->numRows() == 0) { return 0; } else { $row = $result->fetchRow(); return $row[0]; } }
<?php $a = $_GET['id']; mysql_query(int($a)); ## no SQL mysql_query($a); ## SQL! (expected false here, DiveInferno design error)
function format_size_bytes($string) { log_debug("misc", "Executing format_size_bytes({$string})"); if (!$string) { // unknown - most likely the program hasn't called one one of the fetch_information_by_* functions first. log_debug("misc", "Error: Unable to determine file size - no value provided"); return "unknown size"; } else { $string = strtolower($string); $string = preg_replace("/\\s*/", "", $string); // strip spaces $string = preg_replace("/,/", "", $string); // strip formatting $string = preg_match("/^([0-9]*)([a-z]*)\$/", $string, $values); if ($values[2]) { switch ($values[2]) { case "g": case "gb": $bytes = $values[1] * 1024 * 1024 * 1024; break; case "m": case "mb": $bytes = $values[1] * 1024 * 1024; break; case "k": case "kb": $bytes = $values[1] * 1024; break; case "b": case "bytes": default: $bytes = int($values[1]); break; } } else { // assume value must be in bytes already. $bytes = int($values[1]); } return $bytes; } }
public function get_val() { $val = explode('-', $this->val); return int($val[count($val) - 1]); }
function delete() { sql_do('DELETE FROM licenses WHERE id_lic=\'' . int($this->get_id_lic()) . '\''); }
public function genPet($grade, $lv, $diffGrade, $randomGrade, $addBP, $intResult = true, $times = 20, $originLv = 1, $series = 0) { $this->load->helper('vector'); $base = array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100); $addBP = $this->pet_model->arrayToGrade(explode(',', $addBP)); $diffGrade = $this->pet_model->arrayToGrade($this->pet_model->charsToArray($diffGrade)); $randomGrade = $this->pet_model->arrayToGrade($this->pet_model->charsToArray($randomGrade)); $base = mul(1000, $base); $addBP = mul(100, $addBP); $grownGrade = up0(minus($grade, $diffGrade)); $lvOneTotalBP = mul($times, plus($grownGrade, $randomGrade)); //echo "1bp:";print_r($lvOneTotalBP); $grownBP = mul(($lv - 1) * 100, $this->tnt($grownGrade)); //echo "grown";print_r($grownBP); $totalBP = int(plus($lvOneTotalBP, plus($grownBP, $addBP))); foreach ($base as $type => $value) { $tmp = $this->getPropFromBP($type, $totalBP); $base[$type] += $tmp; } $base = array_merge($base, mul(10, $totalBP)); if ($intResult) { $base = int(mul(0.001, $base)); } else { $base = mul(0.001, $base); } $results = array(); $results[0] = $base; //产生常见的maxmin $rmmindiff = $this->arrayToGrade(array(0, 0, 0, 0, 0)); $rmmaxdiff = $this->arrayToGrade(array(0, 0, 0, 0, 0)); foreach ($grownGrade as $key => $gd) { $gdmod = $gd % 5; switch ($gdmod) { case 0: $rmmindiff[$key] = -1 * min($lv - 1, round(sqrt($lv - 1) * 6 + 1)) * 0.5; $rmmaxdiff[$key] = +1 * min($lv - 1, round(sqrt($lv - 1) * 6 + 1)) * 0.5; break; case 4: case 1: $rmmindiff[$key] = -0.5 * 3; $rmmaxdiff[$key] = +0.5 * 3; break; default: break; } } $totalBPRmmMax = plus($totalBP, $rmmaxdiff); $propRmmMax = mul(1000, array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100)); $propRmmMin = mul(1000, array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100)); foreach ($propRmmMax as $type => $value) { $tmp = $this->getPropFromBP($type, int($totalBPRmmMax)); $propRmmMax[$type] += $tmp; } $propRmmMax = array_merge($propRmmMax, mul(10, $totalBPRmmMax)); if ($intResult) { $propRmmMax = int(mul(0.001, $propRmmMax)); } else { $propRmmMax = mul(0.001, $propRmmMax); } $totalBPRmmMin = plus($totalBP, $rmmindiff); foreach ($propRmmMin as $type => $value) { $tmp = $this->getPropFromBP($type, int($totalBPRmmMin)); $propRmmMin[$type] += $tmp; } $propRmmMin = array_merge($propRmmMin, mul(10, $totalBPRmmMin)); if ($intResult) { $propRmmMin = int(mul(0.001, $propRmmMin)); } else { $propRmmMin = mul(0.001, $propRmmMin); } $results[1] = $propRmmMin; $results[2] = $propRmmMax; return $results; }
public function toInt() { return int($this); }
function IXR_Date($time) { // $time can be a PHP timestamp or an ISO one if (int($time) == $time) { $this->parseTimestamp($time); } else { $this->parseIso($time); } }
function orders() { if ($this->input->get('last', TRUE) != NULL and $this->input->get('id', TRUE) == NULL) { if ($this->input->get('last') == 'all') { $orders = $this->db->query('SELECT id FROM orders WHERE guid=""')->result_array(); $this->output->set_header('Content-Type: application/json; charset=utf-8'); $this->output->set_output(json_encode($orders)); } else { $last = int($this->input->get('last')); $orders = $this->db->query('SELECT id FROM orders WHERE guid="" ORDER BY id LIMIT ' . $last . '')->result_array(); $this->output->set_header('Content-Type: application/json; charset=utf-8'); $this->output->set_output(json_encode($orders)); } } else { if ($this->input->get('id', TRUE) != NULL and $this->input->get('last', TRUE) == NULL) { $order_main = $this->db->query('SELECT guid as order_guid, price_rur as full_price, DATE_FORMAT(date,"%d.%m.%Y %T") as date, comment, user_guid , manager_guid FROM orders WHERE id=' . $this->input->get('id'))->row_array(); $order_full = $this->db->query('SELECT product_guid, price_rur/number as price, number, char_guid FROM order_products WHERE order_id=' . $this->input->get('id'))->result_array(); $json = array('order_guid' => $order_main['order_guid'], 'full_price' => $order_main['full_price'], 'date' => $order_main['date'], 'comment' => $order_main['comment'], 'user_guid' => $order_main['user_guid'], 'manager_guid' => $order_main['manager_guid'], 'rows' => $order_full); $this->output->set_header('Content-Type: application/json; charset=utf-8'); $this->output->set_output(json_encode($json)); } else { $users = $this->db->query("SELECT id, guid FROM orders")->result_array(); $this->output->set_header('Content-Type: application/json; charset=utf-8'); $this->output->set_output(json_encode($users)); } } }
$num++; $htm_tr = $num % 4 == 0 ? '' : ''; $g_checked = strpos($o_weibo_groups, ",{$key},") !== false ? 'checked' : ''; $creategroup .= "<li><input type=\"checkbox\" name=\"groups[]\" value=\"{$key}\" {$g_checked}>{$value}</li>{$htm_tr}"; } } $creategroup && ($creategroup = "<ul class=\"list_A list_120 cc\">{$creategroup}</ul>"); require_once PrintApp('admin'); } else { S::gp(array('creditset', 'creditlog', 'weibophoto', 'weibopost', 'weibourl', 'weibotip', 'weibo_hottopicdays', 'weibo_hotcommentdays', 'weibo_hotfansdays', 'weibo_hottransmitdays'), 'GP'); S::gp(array('groups'), 'GP', 2); $updatecache = false; $config['weibophoto'] = $weibophoto ? 1 : 0; $config['weibopost'] = $weibopost ? 1 : 0; $config['weibourl'] = $weibourl ? 1 : 0; $config['weibo_hottopicdays'] = $weibo_hottopicdays ? int($weibo_hottopicdays) : 7; $config['weibo_hotcommentdays'] = $weibo_hotcommentdays ? intval($weibo_hotcommentdays) : 1; $config['weibo_hottransmitdays'] = $weibo_hottransmitdays ? intval($weibo_hottransmitdays) : 1; $config['weibo_hotfansdays'] = $weibo_hotfansdays ? intval($weibo_hotfansdays) : 1; $config['weibo_creditset'] = ''; $config['weibotip'] = S::escapeStr($weibotip); $config['weibo_groups'] = is_array($groups) ? ',' . implode(',', $groups) . ',' : ''; if (is_array($creditset) && !empty($creditset)) { foreach ($creditset as $key => $value) { foreach ($value as $k => $v) { $creditset[$key][$k] = round($v, $k == 'rvrc' ? 1 : 0); } } $config['weibo_creditset'] = addslashes(serialize($creditset)); } is_array($creditlog) && !empty($creditlog) && ($config['weibo_creditlog'] = addslashes(serialize($creditlog)));
function list_categories() { return get_array_by_query('SELECT id_cat FROM ' . DB_PREF . '_belongsto WHERE id_rel=\'' . int($this->get_id_rel()) . '\''); }
function delete() { sql_do('DELETE FROM platforms WHERE id_pf=\'' . int($this->get_id_pf()) . '\''); }
function list_releases() { return get_array_by_query('SELECT id_rel FROM authors WHERE id_user=\'' . int($this->get_id_user()) . '\''); }
function format_image($args) { $src = array_key_exists('src', $args) ? $args['src'] : ''; $extra = $args['extra']; $align = $args['align']; $pre = array_key_exists('pre', $args) ? $args['pre'] : ''; $post = array_key_exists('post', $args) ? $args['post'] : ''; $link = $args['url']; $clsty = $args['clsty']; _strip_borders($pre, $post); if ($src == '') { return $pre . '!!' . $post; } if (preg_match('/^xhtml2/', $this->flavor)) { $type; # poor man's mime typing. need to extend this externally if (preg_match('/(?:\\.jpeg|\\.jpg)$/i', $src)) { $type = 'image/jpeg'; } elseif (preg_match('/\\.gif$/i', $src)) { $type = 'image/gif'; } elseif (preg_match('/\\.png$/i', $src)) { $type = 'image/png'; } elseif (preg_match('/\\.tiff$/i', $src)) { $type = 'image/tiff'; } $tag = '<object'; if ($type) { $tag .= " type=\"{$type}\""; } $tag .= " data=\"{$src}\""; } else { $tag = "<img src=\"{$src}\""; } if (isset($align)) { if ($this->css_mode) { $alignment = _halign($align); if ($alignment) { $style .= ";float:{$alignment}"; $class .= ' ' . $alignment; } $alignment = _valign($align); if ($alignment) { $imgvalign = preg_match('/(top|bottom)/', $alignment) ? 'text-' . $alignment : $alignment; if ($imgvalign) { $style .= ";vertical-align:{$imgvalign}"; } if ($aligment) { $class .= ' ' . $this->css["class_align_{$alignment}"]; } } } else { $alignment = _halign($align) or _valign($align); if ($alignment) { $tag .= " align=\"{$alignment}\""; } } } if (isset($extra)) { if (preg_match('/\\(([^\\)]+)\\)/', $extra, $matches)) { $alt = $matches[1]; } $extra = preg_replace('/\\([^\\)]+\\)/', '', $extra, 1); if (preg_match('/(?:^|\\s)(\\d+)%(?:\\s|$)/', $extra, $matches)) { $pct = $matches[1]; } if (!$pct) { if (preg_match('/(?:^|\\s)(\\d+)%x(\\d+)%(?:\\s|$)/', $extra, $matches)) { $pctw = $matches[1]; $pcth = $matches[2]; } } else { $pctw = $pct; $pcth = $pct; } if (!$pctw && !$pcth) { if (preg_match('/(?:^|\\s)(\\d+|\\*)x(\\d+|\\*)(?:\\s|$)/', $extra, $matches)) { $w = $matches[1]; $h = $matches[2]; } if ($w == '*') { $w = ''; } if ($h == '*') { $h = ''; } if (!$w) { if (preg_match('/(^|[,\\s])(\\d+)w([\\s,]|$)/', $extra, $matches)) { $w = $matches[1]; } } if (!$h) { if (preg_match('/(^|[,\\s])(\\d+)h([\\s,]|$)/', $extra, $matches)) { $h = $matches[1]; } } } } if (!isset($alt)) { $alt = ''; } if (!preg_match('/^xhtml2/', $this->flavor)) { $tag .= ' alt="' . $this->encode_html_basic($alt) . '"'; } if ($w && $h) { if (!preg_match('/^xhtml2/', $this->flavor)) { $tag .= " height=\"{$h}\" width=\"{$w}\""; } else { $style .= ";height:{$h}\\px;width:{$w}\\px"; } } else { list($image_w, $image_h) = $this->image_size($src); if ($image_w && $image_h && ($w || $h)) { # image size determined, but only width or height specified if ($w && !$h) { # width defined, scale down height proportionately $h = int($image_h * ($w / $image_w)); } elseif ($h && !$w) { $w = int($image_w * ($h / $image_h)); } } else { $w = $image_w; $h = $image_h; } if ($w && $h) { if ($pctw || $pcth) { $w = int($w * $pctw / 100); $h = int($h * $pcth / 100); } if (preg_match('/^xhtml2', $this->flavor)) { $tag .= " height=\"{$h}\" width=\"{$w}\""; } else { $style .= ";height:{$h}\\px;width:{$w}\\px"; } } } $attr = $this->format_classstyle($clsty, $class, $style); if ($attr) { $tag .= " {$attr}"; } if (preg_match('/^xhtml2/', $this->flavor)) { $tag .= '><p>' . $this->encode_html_basic($alt) . '</p></object>'; } elseif (preg_match('/^xhtml/', $this->flavor)) { $tag .= ' />'; } else { $tag .= '>'; } if ($link != '') { $link = preg_replace('/^:/', '', $link); $link = $this->format_url(array('url' => $link)); $tag = '<a href="' . $link . '">' . $tag . '</a>'; } return $pre . $tag . $post; }
function nv_theme_genealogy_detail($row_genealogy, $row_detail, $array_parentid, $OrgChart) { global $global_config, $module_name, $module_file, $lang_module, $my_head, $module_info, $op; if (!defined('SHADOWBOX')) { $my_head .= "<link rel=\"Stylesheet\" href=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.css\" />\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\">Shadowbox.init({ handleOversize: \"drag\" });</script>"; define('SHADOWBOX', true); } $xtpl = new XTemplate("gdetail.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GENEALOGY', $row_genealogy); $xtpl->assign('ACTIVE', 'ui-genealogys-selected'); if (int(count($row_detail['id'])) != 0) { $array_key = array('full_name', 'gender', 'status', 'code', 'name1', 'name2', 'birthday', 'dieday', 'life', 'burial'); $i = 0; $lang_module['u_life'] = $row_detail['life'] >= 50 ? $lang_module['u_life_ht'] : $lang_module['u_life_hd']; foreach ($array_key as $key) { if ($row_detail[$key] != "") { $i++; $dataloop = array('class' => $i % 2 == 0 ? 'class="second"' : '', 'lang' => $lang_module['u_' . $key], 'value' => $row_detail[$key]); $xtpl->assign('DATALOOP', $dataloop); $xtpl->parse('main.info.loop'); } } $xtpl->assign('DATA', $row_detail); foreach ($array_parentid as $array_parentid_i) { $xtpl->assign('PARENTIDCAPTION', $array_parentid_i['caption']); if (isset($array_parentid_i['items'])) { $items = $array_parentid_i['items']; $number = 1; foreach ($items as $item) { $item['number'] = $number++; $item['class'] = $number % 2 == 0 ? 'class="second"' : ''; $xtpl->assign('DATALOOP', $item); $xtpl->parse('main.info.parentid.loop2'); } } $xtpl->parse('main.info.parentid'); } if (!empty($row_detail['content'])) { $xtpl->parse('main.info.content'); } if (!empty($OrgChart)) { $xtpl->assign('DATACHARTROWS', count($OrgChart)); foreach ($OrgChart as $item) { if ($item['id'] == $row_detail['id']) { $item['full_name'] = '<span style="color:red; font-weight: 700">' . $item['full_name'] . '</span>'; } $xtpl->assign('DATACHART', $item); if ($item['number'] > 0) { $xtpl->parse('main.info.orgchart.looporgchart.looporgchart2'); } $xtpl->parse('main.info.orgchart.looporgchart'); } $xtpl->parse('main.info.orgchart'); } $xtpl->parse('main.info'); } else { $xtpl->parse('main.not_info'); } $xtpl->parse('main'); return $xtpl->text('main'); }
if ($row['birthday'] != '0000-00-00 00:00:00') { preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $row['birthday'], $datetime); $row['birthday'] = $datetime[3] . "/" . $datetime[2] . "/" . $datetime[1]; } else { $row['birthday'] = ""; } $row['status'] = $array_status[$row['status']]; $array_parentid[1]['items'][] = $row; } } //die(int($info_users['gender'])); //Danh sách vợ if ($info_users['gender'] == 1) { $query = "SELECT id, parentid, weight, relationships, gender, status, alias, full_name, birthday FROM " . NV_PREFIXLANG . "_" . $module_data . " WHERE gid=" . $info_users['gid'] . " AND parentid=" . $info_users['id'] . " AND relationships=2 ORDER BY weight ASC"; $result = $db->query($query); if (int(count($result)) != 0) { $array_parentid[2]['caption'] = $lang_module['list_parentid_2']; while ($row = $result->fetch()) { $row['link'] = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_fam[$news_contents['fid']]['alias'] . '/' . $news_contents['alias'] . '/' . $alias_family_tree . '/' . $row['alias'] . $global_config['rewrite_exturl'], true); //$row_genealogy['link_main'] . '/' . $row['alias']; if ($row['birthday'] != '0000-00-00 00:00:00') { preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $row['birthday'], $datetime); $row['birthday'] = $datetime[3] . "/" . $datetime[2] . "/" . $datetime[1]; } else { $row['birthday'] = ""; } $row['status'] = $array_status[$row['status']]; $array_parentid[2]['items'][] = $row; } } }