function dateage($d, $params = array('e' => 1, 'd' => 0)) { global $curr; $dd = substr($d, 8, 2); $dm = substr($d, 5, 2); $dy = substr($d, 0, 4); $age = $curr['year'] - $dy - 1; if ($curr['mon'] > $dm) { $age++; } elseif ($curr['mon'] == $dm && $curr['mday'] >= $dd) { $age++; } $r = $age; if ($params['e']) { $r = $r . ' ' . ends($age, 'year'); } return $r; }
$mrcs = array(); while ($mrc = DB::fetch($query)) { $mrc['time'] = dgmdate($mrc['lasttime'], 'Ymd', $_G['setting']['timeoffset']); DB::query("REPLACE INTO " . $amuppertablenew . " (uid, uname, lasttime, time, cons, addup, allow) VALUES ('{$mrc['uid']}', '{$mrc['uname']}', '{$mrc['lasttime']}', '{$mrc['time']}', '{$mrc['continuous']}', '{$mrc['addup']}', '0')"); } } else { ends(); } if ($page < $maxpage) { cpmsg(lang('plugin/dsu_amupper', 'admin_ing', array('jindu' => $page . '/' . $maxpage)), 'action=plugins&operation=config&identifier=dsu_amupper&pmod=upgrade&reserve=' . $reserve . '&submit=submit&formhash=' . $formhash . '&page=' . $nextpage, 'loading'); } else { if ($reserve) { $sql = 'DROP TABLE ' . $amuppertable; DB::query($sql); } ends(); } } function ends() { $queryn = DB::query("SHOW TABLES LIKE '{$amuppertablenew}'"); $amuppertable_existn = 0; if (DB::num_rows($queryn) > 0) { $amuppertable_existn = 1; } $queryc = DB::query("SHOW TABLES LIKE '{$amuppertablenewc}'"); $amuppertable_existc = 0; if (DB::num_rows($queryc) > 0) { $amuppertable_existc = 1; } if ($amuppertable_existc == 1 && $amuppertable_existn == 1) {
public function ends($column, $value) { $this->model->setCondition(ends($column, $value)); return $this; }