本文整理汇总了PHP中Ceil函数的典型用法代码示例。如果您正苦于以下问题:PHP Ceil函数的具体用法?PHP Ceil怎么用?PHP Ceil使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Ceil函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPage
public function setPage($page, $table, $where)
{
$this->limite = 10;
$this->inicio = $page * $this->limite - $this->limite;
$paginacao = new Model();
if ($where) {
$where = " {$where} AND";
}
$num_reg = $paginacao->query("SELECT is_ativo FROM {$table} WHERE {$where} id_empresa='{$this->id_empresa}' AND is_ativo='1'", "count");
$this->total_paginas = Ceil($num_reg / $this->limite);
}
示例2: randomStr
public function randomStr($length)
{
$n_Caratteri = $length;
$stringa = "";
for ($i = 0; $i < $n_Caratteri; $i++) {
do {
$n = Ceil(rand(48, 122));
} while (!($n >= 48 && $n <= 57 || $n >= 65 && $n <= 90 || $n >= 97 && $n <= 122));
$stringa = $stringa . chr($n);
}
return $stringa;
}
示例3: query
//.........这里部分代码省略.........
* Filter the sql template limit
*
* @since 2.0
*
* @param string $limit
*/
$limit = apply_filters("simple_history/log_query_limit", $limit);
/**
* Filter the sql template limit
*
* @since 2.0
*
* @param string $limit
*/
$inner_where = apply_filters("simple_history/log_query_inner_where", $inner_where);
$sql = sprintf($sql_tmpl, $where, $limit, $table_name, $inner_where, $table_name_contexts);
/**
* Filter the final sql query
*
* @since 2.0
*
* @param string $sql
*/
$sql = apply_filters("simple_history/log_query_sql", $sql);
// Remove comments below to debug query (includes query in json result)
// $include_query_in_result = true;
if (isset($_GET["SimpleHistoryLogQuery-showDebug"]) && $_GET["SimpleHistoryLogQuery-showDebug"]) {
echo "<pre>";
echo $sql_set_var;
echo $sql;
exit;
}
// Only return sql query
if ($args["returnQuery"]) {
return $sql;
}
$log_rows = $wpdb->get_results($sql, OBJECT_K);
$num_rows = sizeof($log_rows);
// Find total number of rows that we would have gotten without pagination
// This is the number of rows with occasions taken into consideration
$sql_found_rows = 'SELECT FOUND_ROWS()';
$total_found_rows = (int) $wpdb->get_var($sql_found_rows);
// Add context
$post_ids = wp_list_pluck($log_rows, "id");
if (empty($post_ids)) {
$context_results = array();
} else {
$sql_context = sprintf('SELECT * FROM %2$s WHERE history_id IN (%1$s)', join(",", $post_ids), $table_name_contexts);
$context_results = $wpdb->get_results($sql_context);
}
foreach ($context_results as $context_row) {
if (!isset($log_rows[$context_row->history_id]->context)) {
$log_rows[$context_row->history_id]->context = array();
}
$log_rows[$context_row->history_id]->context[$context_row->key] = $context_row->value;
}
// Remove id from keys, because they are cumbersome when working with JSON
$log_rows = array_values($log_rows);
$min_id = null;
$max_id = null;
if (sizeof($log_rows)) {
// Max id is simply the id of the first row
$max_id = reset($log_rows)->id;
// Min id = to find the lowest id we must take occasions into consideration
$last_row = end($log_rows);
$last_row_occasions_count = (int) $last_row->subsequentOccasions - 1;
if ($last_row_occasions_count === 0) {
// Last row did not have any more occasions, so get min_id directly from the row
$min_id = $last_row->id;
} else {
// Last row did have occaions, so fetch all occasions, and find id of last one
$db_table = $wpdb->prefix . SimpleHistory::DBTABLE;
$sql = sprintf('
SELECT id, date, occasionsID
FROM %1$s
WHERE id <= %2$s
ORDER BY id DESC
LIMIT %3$s
', $db_table, $last_row->id, $last_row_occasions_count + 1);
$results = $wpdb->get_results($sql);
// the last occasion has the id we consider last in this paged result
$min_id = end($results)->id;
}
}
// Calc pages
if ($args["posts_per_page"]) {
$pages_count = Ceil($total_found_rows / (int) $args["posts_per_page"]);
} else {
$pages_count = 1;
}
// Create array to return
// Make all rows a sub key because we want to add some meta info too
$log_rows_count = sizeof($log_rows);
$page_rows_from = (int) $args["paged"] * (int) $args["posts_per_page"] - (int) $args["posts_per_page"] + 1;
$page_rows_to = $page_rows_from + $log_rows_count - 1;
$arr_return = array("total_row_count" => $total_found_rows, "pages_count" => $pages_count, "page_current" => (int) $args["paged"], "page_rows_from" => $page_rows_from, "page_rows_to" => $page_rows_to, "max_id" => (int) $max_id, "min_id" => (int) $min_id, "log_rows_count" => $log_rows_count, "log_rows" => $log_rows);
#sf_d($arr_return, '$arr_return');exit;
wp_cache_set($cache_key, $arr_return, $cache_group);
return $arr_return;
}
示例4: getTableCS
function getTableCS($c, $query, $name, $type, $num_rows, $compania, $pag, $limite)
{
$resp = mysql_query($query);
// Consulta SQL
if (!$resp) {
// Checa consulta
echo "erro na consulta {$query}";
echo mysql_error();
mysql_close($c);
die;
}
$tot_pag = Ceil($num_rows / $limite);
// Ceil arredonda o resultado para cima
$inicio = $pag * $limite - $limite;
$line = mysql_fetch_assoc($resp);
if (!$line) {
$resposta = false;
} else {
$keys = array_keys($line);
// Pega um array com o nome(key) das colunas que referenciam os campos da tupla pegada em $line
$length = count($keys);
// Pega o número de elementos do array $keys
$resposta = "<div class='CSSTableGenerator' style='width: 95%'>\n\t\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td colspan='" . $length . "'><center>{$name}</td>\n\t\t\t</tr>";
$resposta .= "<tr>";
for ($i = 1; $i < $length; $i++) {
$colName = $keys[$i];
$resposta .= "<td style='background-color: #193a73'><center><big><big><b><font color='white'>{$colName}</td>";
}
$resposta .= "</tr>";
while ($line) {
// Põe linhas da tabela
// Neste for() eu ponho os campos de cada coluna, porém, para acessar os valores dentro
// do array $line eu preciso do nome(key) que o referencia ($line[key]),
// e não de um número. Este nome é o nome da coluna em que ele está, na qual obtenho do array $keys.
$id = $line['id'];
$resposta .= "<tr>";
for ($i = 1; $i < $length; $i++) {
// Põe nomes das colunas da tabela
$informacao = $line[$keys[$i]];
if ($type == 0) {
$resposta .= "<td><center><big><big><font>{$informacao}</td>";
} else {
if ($type == 1 && $i == 1) {
$resposta .= "<td><a href='student_search.php?id={$id}'><div class='fonte'>{$informacao}</div></a></td>";
} else {
if ($type == 2 && $i == 1) {
$resposta .= "<td><a href='company_search.php?id={$id}'><div class='fonte'>{$informacao}</div></a></td>";
} else {
$resposta .= "<td><center><div class='fonte'>{$informacao}</div></td>";
}
}
}
}
$resposta .= "</tr>";
$line = mysql_fetch_assoc($resp);
}
$resposta .= "</table>";
$resposta .= "</div><div class='paginacao'>";
for ($i = 1; $i <= $tot_pag; $i++) {
if ($pag == $i) {
$resposta .= "| {$i} |";
} else {
$resposta .= "<a href='company_search.php?company={$compania}&pag={$i}'> | {$i} | </a>";
}
}
$resposta .= "</div>";
}
return $resposta;
}
示例5: GetPageNumbers
function GetPageNumbers($entries)
{
global $config;
global $link;
$prev = "«Trở lại";
$next = "Tiếp»";
$config['totalPages'] = Ceil($entries / ($config['cols'] * $config['rows']));
$start = 0;
$end = $config['totalPages'] - 1;
echo " Trang: ";
if ($config['maxShow'] < $config['page'] || $config['cols'] * $config['rows'] * $config['maxShow'] < $entries) {
if ($config['page'] >= $config['maxShow'] + 1 && $config['page'] < $end - $config['maxShow']) {
$start = $config['page'] - $config['maxShow'];
} elseif ($end < $config['page'] + $config['maxShow'] + 1 && $config['totalPages'] - 1 >= $config['maxShow'] * 2 + 1) {
$start = $config['totalPages'] - 1 - $config['maxShow'] * 2;
} else {
$start = 0;
}
if ($config['page'] + $config['maxShow'] + 1 > $config['totalPages'] - 1) {
$end = $entries / ($config['cols'] * $config['rows']);
} elseif ($start == 0 && $end > $config['maxShow'] * 2) {
$end = $config['maxShow'] * 2;
} elseif ($start == 0 && $config['totalPages'] <= $config['maxShow'] * 2) {
$end = $config['totalPages'] - 1;
} else {
$end = $config['page'] + $config['maxShow'];
}
}
if ($start > 0) {
echo " ... ";
} else {
echo "";
}
for ($i = $start; $i <= $end; $i++) {
if ($config['page'] == $i) {
echo "[" . ($i + 1) . "] \n";
} else {
echo "<a href=\"{$link}&page={$i}\">" . ($i + 1) . "</a>\n";
}
}
if (Ceil($end) < $config['totalPages'] - 1) {
echo " ... ";
} else {
echo "";
}
}
示例6: gException
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'false':
return ERROR | @Trigger_Error(700);
case 'true':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# реализация JBS-965 - запрещаем писать в старые тикеты юзерам
if ($Settings['EdeskOldDays'] && !$__USER['IsAdmin'] && !isset($GLOBALS['IsCron'])) {
if ($Ticket['StatusDate'] < Time() - IntVal($Settings['EdeskOldDays']) * 24 * 3600) {
return new gException('EDESK_TOO_OLD', SPrintF('Вы пишете в слишком старый тикет (%u дн.), скопируйте ваше сообщение и создайте новый тикет', Ceil(Time() - $Ticket['StatusDate']) / (24 * 3600)));
}
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($Flags == "No" && !$Message) {
return new gException('MESSAGE_IS_EMPTY', 'Введите сообщение');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($Ticket['UserID'] == $__USER['ID'] && $Ticket['Flags'] == "DenyAddMessage") {
return new gException('DENY_ADD_MESSAGE', 'Тема содержит очень большое количество сообщений. У сотрудников технической поддержки возникают затруднения с перечитыванием истории переписки. Пожалуйста, опишите вашу проблему и создайте новый запрос.');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# реализация JBS-1093 - ограничение на максимальное число сообщений в тикете
示例7: Ceil
$NewPriceReg = $Prices[$Key]['new'] + $Settings['DomainMinMarginSumm'];
}
#-------------------------------------------------------------------------------
# округляем в большую сторону до 10 рублей
$NewPriceReg = Ceil($NewPriceReg / 10) * 10;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# считаем цену продления
$NewPriceProlong = $Prices[$Key]['renew'] * (100 + IntVal($Settings['DomainMinMarginPercent'])) / 100;
#-------------------------------------------------------------------------------
if ($NewPriceProlong - $Prices[$Key]['renew'] < $Settings['DomainMinMarginSumm']) {
$NewPriceProlong = $Prices[$Key]['renew'] + $Settings['DomainMinMarginSumm'];
}
#-------------------------------------------------------------------------------
# округляем в большую сторону до 10 рублей
$NewPriceProlong = Ceil($NewPriceProlong / 10) * 10;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# на перенос выставляем максимальную из цен - регистрация/перенос
$NewPriceTransfer = $NewPriceReg;
#-------------------------------------------------------------------------------
if ($NewPriceProlong > $NewPriceReg) {
$NewPriceTransfer = $NewPriceProlong;
}
#-------------------------------------------------------------------------------
$NewPriceTransfer = In_Array($Key, array('ru', 'su', 'рф')) ? 0 : $NewPriceTransfer;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие такого тарифа в биллинге
if (In_Array($Key, Array_Keys($Schemes))) {
#-------------------------------------------------------------------------------
示例8:
$tab_ele=array();
if(mysqli_num_rows($res_ele)>0) {
$cpt=0;
while($lig_ele=mysqli_fetch_object($res_ele)) {
$tab_ele[$cpt]=array();
$tab_ele[$cpt]['login']=$lig_ele->login;
$tab_ele[$cpt]['elenoet']=$lig_ele->elenoet;
$tab_ele[$cpt]['nom']=$lig_ele->nom;
$tab_ele[$cpt]['prenom']=$lig_ele->prenom;
$cpt++;
}
$classe=get_class_from_id($id_classe[$i]);
$nb_pages=Ceil($cpt/$nb_cell);
//echo "\$nb_pages=$nb_pages<br />";
$cpt=0;
for($j=0;$j<$nb_pages;$j++) {
$pdf->AddPage("P");
$pdf->SetXY($x0,$y0);
$bordure='LRBT';
//$bordure='';
$pdf->SetFont('DejaVu','B',$fonte_size_classe);
$texte="Classe de $classe";
$pdf->Cell($largeur_utile_page,$hauteur_classe,$texte,$bordure,1,'C');
$pdf->SetFont('DejaVu','',$fonte_size);
示例9: mysql_select_db
mysql_select_db($db_name, $cn) or die("Could not select database");
//Получаем массив параметров
$id_theme = $_POST["id_theme"];
$tpls_count = $_POST["tpls_count"];
//Получаем название тематики шаблонов
$result = mysql_query("SELECT `id`, `name` FROM `themes` WHERE `id` = {$id_theme}");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$theme_name = $row["name"];
}
mysql_free_result($result);
if (trim($tpls_count) == '' && !is_numeric($tpls_count)) {
mysql_close($cn);
header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
exit;
}
$tpls_count = Abs(Ceil($tpls_count));
$W_H = get_baner_sizes($id_theme);
for ($i = 0; $i < $tpls_count; $i++) {
//запуск генерации шаблона
$tpl = generate_tpl($W_H);
$tpl_content = $tpl['content'];
$tpl_style = $tpl['style'];
$tpl_name = $theme_name . $i;
//Добавляем шаблон в базу
$result = mysql_query("INSERT INTO `dor_tpls` (`name`, `tpl_status`, `id_theme`) VALUES ('{$tpl_name}', 'blocked', '{$id_theme}')");
if (!$result) {
echo "Ошибка вставки данных в базу" . mysql_error();
exit;
}
//Получаем id вставленной записи
$result = mysql_query("SELECT LAST_INSERT_ID()");
示例10: IspManager4_Scheme_Change
function IspManager4_Scheme_Change($Settings, $Login, $HostingScheme)
{
/****************************************************************************/
$__args_types = array('array', 'string', 'array');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$authinfo = SPrintF('%s:%s', $Settings['Login'], $Settings['Password']);
#-----------------------------------------------------------------------------
$HTTP = IspManager4_Build_HTTP($Settings);
#-----------------------------------------------------------------------------
$IsReselling = $HostingScheme['IsReselling'];
#-----------------------------------------------------------------------------
$Request = array('authinfo' => $authinfo, 'out' => 'xml', 'func' => $IsReselling ? 'reseller.edit' : 'user.edit', 'elid' => $Login, 'sok' => 'yes', 'name' => $Login, 'ip' => $IsReselling ? 'noassign' : $Settings['Params']['IP'], 'preset' => $HostingScheme['PackageID'], 'disklimit' => $HostingScheme['QuotaDisk'], 'ftplimit' => $HostingScheme['QuotaFTP'], 'maillimit' => $HostingScheme['QuotaEmail'], 'domainlimit' => $HostingScheme['QuotaDomains'], 'webdomainlimit' => $HostingScheme['QuotaWWWDomains'], 'maildomainlimit' => $HostingScheme['QuotaEmailDomains'], 'baselimit' => $HostingScheme['QuotaDBs'], 'baseuserlimit' => $HostingScheme['QuotaUsersDBs'], 'bandwidthlimit' => $HostingScheme['QuotaTraffic'], 'email' => $HostingScheme['Email'], 'shell' => $HostingScheme['IsShellAccess'] ? 'on' : 'off', 'ssl' => $HostingScheme['IsSSLAccess'] ? 'on' : 'off', 'cgi' => $HostingScheme['IsCGIAccess'] ? 'on' : 'off', 'ssi' => $HostingScheme['IsSSIAccess'] ? 'on' : 'off', 'phpmod' => $HostingScheme['IsPHPModAccess'] ? 'on' : 'off', 'phpcgi' => $HostingScheme['IsPHPCGIAccess'] ? 'on' : 'off', 'phpfcgi' => $HostingScheme['IsPHPFastCGIAccess'] ? 'on' : 'off', 'safemode' => $HostingScheme['IsPHPSafeMode'] ? 'on' : 'off', 'cpulimit' => $HostingScheme['MaxExecutionTime'], 'memlimit' => Ceil($HostingScheme['QuotaMEM']), 'proclimit' => $HostingScheme['QuotaPROC'], 'maxclientsvhost' => $HostingScheme['QuotaMPMworkers'], 'mysqlquerieslimit' => $HostingScheme['mysqlquerieslimit'], 'mysqlupdateslimit' => $HostingScheme['mysqlupdateslimit'], 'mysqlconnectlimit' => $HostingScheme['mysqlconnectlimit'], 'mysqluserconnectlimit' => $HostingScheme['mysqluserconnectlimit'], 'mailrate' => $HostingScheme['mailrate']);
#-----------------------------------------------------------------------------
if (!$IsReselling) {
$Request['owner'] = $Settings['Login'];
} else {
$Request['userlimit'] = $HostingScheme['QuotaUsers'];
}
# Пользователи
#-----------------------------------------------------------------------------
$Response = HTTP_Send('/manager/ispmgr', $HTTP, array(), $Request);
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[IspManager4_Scheme_Change]: не удалось соедениться с сервером');
}
#-----------------------------------------------------------------------------
$Response = Trim($Response['Body']);
#-----------------------------------------------------------------------------
$XML = String_XML_Parse($Response);
if (Is_Exception($XML)) {
return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
}
#-----------------------------------------------------------------------------
$XML = $XML->ToArray();
#-----------------------------------------------------------------------------
$Doc = $XML['doc'];
#-----------------------------------------------------------------------------
if (isset($Doc['error'])) {
return new gException('SCHEME_CHANGE_ERROR', 'Не удалось изменить тарифный план для заказа хостинга');
}
#-----------------------------------------------------------------------------
if (!$Settings['Params']['NoRestartSchemeChange']) {
$Request = array('authinfo' => SPrintF('%s:%s', $Settings['Login'], $Settings['Password']), 'out' => 'xml', 'func' => 'restart');
#-----------------------------------------------------------------------------
$Response = HTTP_Send('/manager/ispmgr', $HTTP, array(), $Request);
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[IspManager4_Scheme_Change]: не удалось соедениться с сервером');
}
}
#-----------------------------------------------------------------------------
return TRUE;
}
示例11: month_stats_overall
public function month_stats_overall()
{
if (!isset($this->rknclass->get['month']) || !ctype_digit($this->rknclass->get['month']) || !isset($this->rknclass->get['year']) || !isset($this->rknclass->get['year'])) {
exit($this->rknclass->global_tpl->admin_error('Invalid data'));
}
$stats_file = RKN__fullpath . 'statsdata/' . $this->rknclass->get['year'] . '/' . $this->rknclass->get['month'] . '/month.sqlite';
$conn = @sqlite_open($stats_file);
if (!$conn) {
exit($this->rknclass->global_tpl->admin_error('The stats file is corrupt.'));
}
$time = strtotime($this->rknclass->get['month'] . '/13/' . $this->rknclass->get['year']);
$month = date('F', $time);
$page_title = "Statistics for {$month} {$this->rknclass->get['year']}";
$this->rknclass->page_title = $page_title;
$this->rknclass->global_tpl->admin_header();
$this->rknclass->settings['trade_type'] === 'credits' ? $type = 'Credits' : ($type = 'Ratio');
echo "<div class=\"page-title\">{$page_title}</div>";
echo "<table id=\"listings\" cellpadding=\"1\" cellspacing=\"1\">\n <tr id=\"columns\">\n <th scope=\"col\" id=\"title\">Site Url</th>\n <th scope=\"col\">Unique In</th>\n <th scope=\"col\">Unique Out</th>\n <th scope=\"col\">Raw In</th>\n <th scope=\"col\">Raw Out</th>\n <th scope=\"col\">Unique<br />{$type}</th>\n <th scope=\"col\">Plug Prod.</th>\n <th scope=\"col\">Ad Prod.</th>\n <th scope=\"col\">Top Country</th>\n <th scope=\"col\">Apr</th>\n <th scope=\"col\">Edit</th>\n <th scope=\"col\">Del</th>\n </tr>";
$result = sqlite_query($conn, "SELECT *, (u_total_in - u_total_out) AS credits FROM stats ORDER BY u_total_in DESC");
while ($row = sqlite_fetch_array($result)) {
$url_clean = $this->rknclass->db->escape($row['url']);
$this->rknclass->db->query("SELECT approved, owner FROM " . TBLPRE . "sites WHERE url = '{$url_clean}'");
if ($this->rknclass->db->num_rows() == 0) {
continue;
} else {
$row2 = $this->rknclass->db->fetch_array();
if ($row2['owner'] < 1) {
continue;
}
$row['approved'] = $row2['approved'];
}
$ratio = $this->rknclass->utils->get_trade_by_in_out($row['u_total_in'], $row['u_total_out']);
if ($this->rknclass->utils->trade_check($row['u_total_in'], $row['u_total_out']) === false) {
$ratio = "<font color=\"#e32c00\">{$ratio}" . ($this->rknclass->settings['trade_type'] === 'ratio' ? " %" : "") . "</font>";
} else {
$ratio = "<font color=\"#136f01\">{$ratio}" . ($this->rknclass->settings['trade_type'] === 'ratio' ? " %" : "") . "</font>";
}
if (strlen($row['url']) >= 20) {
$url = substr($row['url'], 0, 17) . '...';
} else {
$url = $row['url'];
}
$perc = @Ceil($row['plug_prod'] / $row['u_total_in'] * 100);
if ($perc > 70) {
$color = 'green';
} elseif ($perc > 50) {
$color = 'orange';
} elseif ($perc > 25) {
$color = 'red';
} else {
$color = 'purple';
}
$pprod = "<strong><font color=\"{$color}\">{$perc} %</font></strong>";
$perc = @Ceil($row['ad_prod'] / $row['u_todays_in'] * 100);
if ($perc > 70) {
$color = 'green';
} elseif ($perc > 50) {
$color = 'orange';
} elseif ($perc > 25) {
$color = 'red';
} else {
$color = 'purple';
}
$bprod = "<strong><font color=\"{$color}\">{$perc} %</font></strong>";
$this->rknclass->db->query("SELECT site_id FROM " . TBLPRE . "sites WHERE url = '{$url_clean}' LIMIT 1");
$row['site_id'] = $this->rknclass->db->result();
$result2 = sqlite_query($conn, "SELECT country_code FROM country_stats WHERE url = '{$url_clean}' ORDER BY uhits DESC LIMIT 1");
if (sqlite_num_rows($result2) == 1) {
$row3 = sqlite_fetch_array($result2);
if ($row3['country_code'] !== '--') {
$this->rknclass->db->query("SELECT country_name FROM " . TBLPRE . "countries WHERE country_code = '{$row3['country_code']}' LIMIT 1");
$country_name = $this->rknclass->db->result();
} else {
$country_name = 'Unknown';
}
$top_country = "<a href=\"index.php?ctr=management&act=country_stats_month&month={$this->rknclass->get['month']}&year={$this->rknclass->get['year']}&id={$row['site_id']}\"><img src=\"{$this->rknclass->settings['site_url']}/flags/{$row3['country_code']}.gif\" alt=\"{$country_name}\" title=\"{$country_name}\" width=\"30\" height=\"18\" border=\"0\"/></a>";
} else {
$top_country = 'N/A';
}
echo "\n<tr id=\"rows\">\n <td id=\"title\"><a href=\"http://{$row['url']}\" target=\"_blank\" title=\"{$row['name']}\">{$url}</a></td>\n <td>{$row['u_total_in']}</td>\n <td>{$row['u_total_out']}</td>\n <td>{$row['r_total_in']}</td>\n <td>{$row['r_total_out']}</td>\n <td><strong>{$ratio}</strong></td>\n <td>{$pprod}</td>\n <td>{$bprod}</td>\n <td>{$top_country}</td>\n <td><strong>" . ($row['approved'] == '0' ? "<font color=\"#e32c00\">No" : "<font color=\"#136f01\">Yes") . "</font></strong></td>\n <td><a href=\"{$this->rknclass->settings['site_url']}/" . RKN__adminpath . "/index.php?ctr=management&act=edit_site&id={$row['site_id']}\"><img src=\"images/pencil.jpg\" border=\"0\" /></a></td>\n <td><a href=\"{$this->rknclass->settings['site_url']}/" . RKN__adminpath . "/index.php?ctr=management_update&act=del_site&id={$row['site_id']}\" onclick=\"return confirm('Are you sure you want to delete this site?');\"><img src=\"images/delete.jpg\" border=\"0\" /></a></td>\n </tr>";
}
echo "\n</table>";
sqlite_close($conn);
$this->rknclass->global_tpl->admin_footer();
}
示例12: VmManager5_KVM_Scheme_Change
//.........这里部分代码省略.........
#-------------------------------------------------------------------------------
if (isset($Doc['error'])) {
return new gException('USER_CHANGE_ERROR', 'Не удалось изменить пользователя');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Response = HTTP_Send('/vmmgr', $HTTP, array(), array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'vm', 'su' => $VPSOrder['Login']));
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[VmManager5_KVM_Scheme_Change]: не удалось соедениться с сервером');
}
#-------------------------------------------------------------------------------
$Response = Trim($Response['Body']);
#-------------------------------------------------------------------------------
$XML = String_XML_Parse($Response);
if (Is_Exception($XML)) {
return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
}
#-------------------------------------------------------------------------------
$XML = $XML->ToArray('elem');
#-------------------------------------------------------------------------------
$Doc = $XML['doc'];
if (isset($Doc['error'])) {
return new gException('VmManager5_KVM_Scheme_Change', 'Не удалось получить список виртуальных машин');
}
#-------------------------------------------------------------------------------
foreach ($Doc as $VM) {
#-------------------------------------------------------------------------------
#Debug(SPrintF('[system/libs/VmManager5_KVM]: VM = %s',print_r($VM,true)));
if (!isset($VM['id'])) {
continue;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Request = array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'vm.edit', 'sok' => 'ok', 'blkiotune' => $VPSScheme['blkiotune'], 'cputune' => Ceil($VPSScheme['cpu']), 'inbound' => SPrintF('%u', $VPSScheme['chrate'] * 1024), 'outbound' => SPrintF('%u', $VPSScheme['chrate'] * 1024), 'mem' => Ceil($VPSScheme['mem']), 'name' => $VPSOrder['Login'], 'vcpu' => $VPSScheme['ncpu'], 'elid' => $VM['id']);
#-------------------------------------------------------------------------------
$Response = HTTP_Send('/vmmgr', $HTTP, array(), $Request);
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[VmManager5_KVM_Scheme_Change]: не удалось соедениться с сервером');
}
#-------------------------------------------------------------------------------
$Response = Trim($Response['Body']);
#-------------------------------------------------------------------------------
$XML = String_XML_Parse($Response);
if (Is_Exception($XML)) {
return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
}
#-------------------------------------------------------------------------------
$XML = $XML->ToArray();
#-------------------------------------------------------------------------------
$Doc = $XML['doc'];
#-------------------------------------------------------------------------------
if (isset($Doc['error'])) {
return new gException('SCHEME_CHANGE_ERROR', 'Не удалось изменить тарифный план для заказа VPS');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# меняем размер диска, достаём список дисков у машины
$Response = HTTP_Send('/vmmgr', $HTTP, array(), array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'vm.volume', 'elid' => $VM['id']));
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[VmManager5_KVM_Scheme_Change]: не удалось соедениться с сервером');
}
#-------------------------------------------------------------------------------
$Response = Trim($Response['Body']);
#-------------------------------------------------------------------------------
$XML = String_XML_Parse($Response);
if (Is_Exception($XML)) {
示例13: parse
//.........这里部分代码省略.........
}
if ($alter_eintrag) {
$alter_eintrag->setAttributes($daten->getAttributes(), false);
if (!$alter_eintrag->save()) {
echo "StadträtInnen 1\n";
var_dump($alter_eintrag->getErrors());
die("Fehler");
}
$daten = $alter_eintrag;
} else {
if (!$daten->save()) {
echo "StadträtInnen 2\n";
var_dump($daten->getErrors());
die("Fehler");
}
}
$unten = explode("Tabellarische Übersicht der Zugehörigkei", $html_details);
$unten = $unten[1];
preg_match_all("/ris_fraktionen_detail\\.jsp\\?risid=(?<fraktion_id>[0-9]+)&periodeid=(?<wahlperiode>[0-9]+)[\"'& ].*tdborder\">(?<mitgliedschaft>[^<]*)<\\/td>.*Funktion[^>]*>(?<funktion>[^<]*) *<.*<\\/tr/siU", $unten, $matches);
for ($i = 0; $i < count($matches[1]); $i++) {
$str_fraktion = new StadtraetInFraktion();
if (preg_match("/^von (?<von_tag>[0-9]+)\\.(?<von_monat>[0-9]+)\\.(?<von_jahr>[0-9]+) bis (?<bis_tag>[0-9]+)\\.(?<bis_monat>[0-9]+)\\.(?<bis_jahr>[0-9]+)\$/", $matches[3][$i], $mitgliedschaft_matches)) {
$str_fraktion->datum_von = $mitgliedschaft_matches["von_jahr"] . "-" . $mitgliedschaft_matches["von_monat"] . "-" . $mitgliedschaft_matches["von_tag"];
$str_fraktion->datum_bis = $mitgliedschaft_matches["bis_jahr"] . "-" . $mitgliedschaft_matches["bis_monat"] . "-" . $mitgliedschaft_matches["bis_tag"];
} elseif (preg_match("/^seit (?<von_tag>[0-9]+)\\.(?<von_monat>[0-9]+)\\.(?<von_jahr>[0-9]+)\$/", $matches[3][$i], $mitgliedschaft_matches)) {
$str_fraktion->datum_von = $mitgliedschaft_matches["von_jahr"] . "-" . $mitgliedschaft_matches["von_monat"] . "-" . $mitgliedschaft_matches["von_tag"];
$str_fraktion->datum_bis = null;
}
$str_fraktion->fraktion_id = $matches["fraktion_id"][$i];
$str_fraktion->stadtraetIn_id = $stadtraetIn_id;
$str_fraktion->wahlperiode = $matches["wahlperiode"][$i];
$str_fraktion->funktion = $matches["funktion"][$i];
$str_fraktion->mitgliedschaft = $matches["mitgliedschaft"][$i];
/** @var array|StadtraetInFraktion[] $bisherige_fraktionen */
$bisherige_fraktionen = StadtraetInFraktion::model()->findAllByAttributes(["stadtraetIn_id" => $stadtraetIn_id]);
/** @var null|StadtraetInFraktion $bisherige */
$bisherige = null;
foreach ($bisherige_fraktionen as $fr) {
if ($fr->fraktion_id == $str_fraktion->fraktion_id && $fr->wahlperiode == $str_fraktion->wahlperiode && $fr->funktion == $str_fraktion->funktion) {
$bisherige = $fr;
}
}
if ($bisherige === null) {
$fraktion = Fraktion::model()->findByPk($str_fraktion->fraktion_id);
if (is_null($fraktion)) {
$frakt_parser = new StadtratsfraktionParser();
$frakt_parser->parse($str_fraktion->fraktion_id, $str_fraktion->wahlperiode);
}
$str_fraktion->save();
$aenderungen = "Neue Fraktionszugehörigkeit: " . $str_fraktion->fraktion->name . "\n";
} else {
if ($bisherige->wahlperiode != $matches["wahlperiode"][$i]) {
$aenderungen .= "Neue Wahlperiode: " . $bisherige->wahlperiode . " => " . $matches["wahlperiode"][$i] . "\n";
}
if ($bisherige->funktion != $matches["funktion"][$i]) {
$aenderungen .= "Neue Funktion in der Fraktion: " . $bisherige->funktion . " => " . $matches["funktion"][$i] . "\n";
}
if ($bisherige->mitgliedschaft != $matches["mitgliedschaft"][$i]) {
$aenderungen .= "Mitgliedschaft in der Fraktion: " . $bisherige->mitgliedschaft . " => " . $matches["mitgliedschaft"][$i] . "\n";
}
if ($bisherige->datum_von != $str_fraktion->datum_von) {
$aenderungen .= "Fraktionsmitgliedschaft Start: " . $bisherige->datum_von . " => " . $str_fraktion->datum_von . "\n";
}
if ($bisherige->datum_bis != $str_fraktion->datum_bis) {
$aenderungen .= "Fraktionsmitgliedschaft Ende: " . $bisherige->datum_bis . " => " . $str_fraktion->datum_bis . "\n";
}
$bisherige->setAttributes($str_fraktion->getAttributes());
$bisherige->save();
}
}
if ($aenderungen != "") {
echo "StadträtIn {$stadtraetIn_id}: Verändert: " . $aenderungen . "\n";
}
if ($aenderungen != "") {
$aend = new RISAenderung();
$aend->ris_id = $daten->id;
$aend->ba_nr = null;
$aend->typ = RISAenderung::$TYP_STADTRAETIN;
$aend->datum = new CDbExpression("NOW()");
$aend->aenderungen = $aenderungen;
$aend->save();
}
if ($this->antraege_alle) {
$text = RISTools::load_file("http://www.ris-muenchen.de/RII/RII/ris_antrag_trefferliste.jsp?nav=2&selWahlperiode=0&steller={$stadtraetIn_id}&txtPosition=0");
if (preg_match("/Suchergebnisse:.* ([0-9]+)<\\/p>/siU", $text, $matches)) {
$seiten = Ceil($matches[1] / 10);
for ($i = 0; $i < $seiten; $i++) {
$this->parse_antraege($stadtraetIn_id, $i);
}
} else {
if (SITE_CALL_MODE != "cron") {
echo "Keine Anträge gefunden\n";
}
}
} else {
for ($i = 0; $i < 2; $i++) {
$this->parse_antraege($stadtraetIn_id, $i);
}
}
}
示例14: gException
case 'exception':
# No more...
break;
case 'array':
#-------------------------------------------------------------------------------
# проверяем, как много таких заказов можно делать
if ($Params['MaxOrders'] > 0 && $OrdersHistory['Counter'] >= $Params['MaxOrders']) {
if (!$GLOBALS['__USER']['IsAdmin']) {
return new gException('TOO_MANY_ORDERS', SPrintF('Для данного тарифного плана существует ограничение на максимальное число заказов, равное %s. Ранее, вы уже делали заказы по данному тарифу%s, и больше сделать не можете. Выберите другой тарифный план.', $Params['MaxOrders'], $OrdersHistory['Counter'] > $Params['MaxOrders'] ? SPrintF(' (%s)', $OrdersHistory['Counter']) : ''));
}
}
#-------------------------------------------------------------------------------
# проверяем, как часто можно делать такие заказы
if ($Params['MinOrdersPeriod'] > 0 && $Params['MinOrdersPeriod'] > (Time() - $OrdersHistory['LastDate']) / (24 * 60 * 60)) {
if (!$GLOBALS['__USER']['IsAdmin']) {
return new gException('TOO_MANY_ORDER_RATE', SPrintF('Для данного тарифного плана существует ограничение на частоту заказа. Тариф можно заказывать не чаще чем раз в %s дней. До возможности сделать заказ осталось %s дней. Пока, вы можете выбрать другой тарифный план.', $Params['MinOrdersPeriod'], Ceil($Params['MinOrdersPeriod'] - (Time() - $OrdersHistory['LastDate']) / (24 * 60 * 60))));
}
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# вносим заказ в таблицу, если его там нет
$IOrdersHistory['UserID'] = $UserID;
$IOrdersHistory['Email'] = $GLOBALS['__USER']['Email'];
$IOrdersHistory['ServiceID'] = $Params['ServiceID'];
示例15: privacy_image_cache_plugin_admin
/**
* @param App $a
* @param null|object $o
*/
function privacy_image_cache_plugin_admin(&$a, &$o)
{
$o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("picsave") . '">';
$cachetime = get_config('privacy_image_cache', 'cache_time');
if (!$cachetime) {
$cachetime = PRIVACY_IMAGE_CACHE_DEFAULT_TIME;
}
$cachetime_h = Ceil($cachetime / 3600);
$o .= '<label for="pic_cachetime">' . t('Lifetime of the cache (in hours)') . '</label>
<input id="pic_cachetime" name="cachetime" type="text" value="' . escape_tags($cachetime_h) . '"><br style="clear: both;">';
$o .= '<input type="submit" name="save" value="' . t('Save') . '">';
$o .= '<h4>' . t('Cache Statistics') . '</h4>';
$num = q('SELECT COUNT(*) num, SUM(LENGTH(data)) size FROM `photo` WHERE `uid`=0 AND `contact-id`=0 AND `resource-id` LIKE "pic:%%"');
$o .= '<label for="statictics_num">' . t('Number of items') . '</label><input style="color: gray;" id="statistics_num" disabled value="' . escape_tags($num[0]['num']) . '"><br style="clear: both;">';
$size = Ceil($num[0]['size'] / (1024 * 1024));
$o .= '<label for="statictics_size">' . t('Size of the cache') . '</label><input style="color: gray;" id="statistics_size" disabled value="' . $size . ' MB"><br style="clear: both;">';
$o .= '<input type="submit" name="delete_all" value="' . t('Delete the whole cache') . '">';
}