本文整理汇总了PHP中isnum函数的典型用法代码示例。如果您正苦于以下问题:PHP isnum函数的具体用法?PHP isnum怎么用?PHP isnum使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isnum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showratings
function showratings($rating_type, $rating_item_id, $rating_link)
{
global $locale, $userdata;
$settings = \fusion_get_settings();
if ($settings['ratings_enabled'] == "1") {
if (iMEMBER) {
$d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM " . DB_RATINGS . " WHERE rating_item_id='" . $rating_item_id . "' AND rating_type='" . $rating_type . "' AND rating_user='" . $userdata['user_id'] . "'"));
if (isset($_POST['post_rating'])) {
// Rate
if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) {
$result = dbquery("INSERT INTO " . DB_RATINGS . " (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip, rating_ip_type) VALUES ('{$rating_item_id}', '{$rating_type}', '" . $userdata['user_id'] . "', '" . $_POST['rating'] . "', '" . time() . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
if ($result) {
defender::unset_field_session();
}
}
redirect($rating_link);
} elseif (isset($_POST['remove_rating'])) {
// Unrate
$result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='{$rating_item_id}' AND rating_type='{$rating_type}' AND rating_user='" . $userdata['user_id'] . "'");
if ($result) {
defender::unset_field_session();
}
redirect($rating_link);
}
}
$ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
if (!iMEMBER) {
$message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a>", $locale['r104']);
if (fusion_get_settings("enable_registration") == TRUE) {
$message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a> " . $locale['or'] . " <a href='" . BASEDIR . "register.php'>" . $locale['register'] . "</a>", $locale['r104']);
}
echo "<div class='text-center'>" . $message . "</div>\n";
} elseif (isset($d_rating['rating_vote'])) {
echo "<div class='display-block'>\n";
echo openform('removerating', 'post', $rating_link, array('class' => 'display-block text-center'));
echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp'])) . "<br /><br />\n";
echo form_button('remove_rating', $locale['r102'], $locale['r102'], array('class' => 'btn-default', 'icon' => 'fa fa-times m-r-10'));
echo closeform();
echo "</div>\n";
} else {
echo "<div class='display-block'>\n";
echo openform('postrating', 'post', $rating_link, array('max_tokens' => 1, 'notice' => 0, 'class' => 'm-b-20 text-center'));
echo form_select('rating', $locale['r106'], '', array('options' => $ratings, 'class' => 'display-block text-center'));
echo form_button('post_rating', $locale['r103'], $locale['r103'], array('class' => 'btn-primary btn-sm', 'icon' => 'fa fa-thumbs-up m-r-10'));
echo closeform();
echo "</div>\n";
}
$rating_votes = dbarray(dbquery("\n\t\tSELECT\n\t\tSUM(IF(rating_vote='5', 1, 0)) as r120,\n\t\tSUM(IF(rating_vote='4', 1, 0)) as r121,\n\t\tSUM(IF(rating_vote='3', 1, 0)) as r122,\n\t\tSUM(IF(rating_vote='2', 1, 0)) as r123,\n\t\tSUM(IF(rating_vote='1', 1, 0)) as r124\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='" . $rating_type . "' and rating_item_id='" . intval($rating_item_id) . "'\n\t\t"));
if (!empty($rating_votes)) {
echo "<div id='ratings' class='rating_container'>\n";
foreach ($rating_votes as $key => $num) {
echo progress_bar($num, $locale[$key], FALSE, '10px', TRUE, FALSE);
}
echo "</div>\n";
} else {
echo "<div class='text-center'>" . $locale['r101'] . "</div>\n";
}
}
}
示例2: dj_info_box
function dj_info_box($id = "0", $info = "Keine Infos", $feld_id, $name = "")
{
global $sp_settings, $userdata, $locale;
$ausgabe = "";
if (!isnum($id)) {
fallback("index.php");
}
if ($id > 0) {
$info_result = dbquery("SELECT * FROM " . DB_USERS . " WHERE user_id='" . $id . "'");
if (dbrows($info_result) != 0) {
$user_info = dbarray($info_result);
if (sp_check($sp_settings['grss_sgroup'], $user_info['user_groups'])) {
$mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp125'] . "<br /><br />";
} elseif (sp_check($sp_settings['grss_ggroup'], $user_info['user_groups'])) {
$mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp126'] . "<br /><br />";
} else {
$mod = "";
}
if ($user_info['user_avatar'] != "") {
$avatar = IMAGES . "avatars/" . $user_info['user_avatar'];
} else {
$avatar = IMAGES . "avatars/nopic.gif";
}
$infos = "<div align=\\'center\\'><img src=\\'" . $avatar . "\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $user_info['user_name'] . "</span><br /><br />" . $mod . "<b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
$ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');" href="' . BASEDIR . 'profile.php?lookup=' . $user_info['user_id'] . '">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . $avatar . "\" height=\"40\" border=\"0\" /><br />" : "") . $user_info['user_name'] . '</a>';
if ((sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) && $userdata['user_id'] == $user_info['user_id'] || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
if ($sp_settings['grss_djedit'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
}
if ($sp_settings['grss_djoff'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
}
}
}
} elseif ($id == 0 && $name != "") {
$infos = "<div align=\\'center\\'><img src=\\'" . IMAGES . "avatars/nopic.gif\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $name . "</span><br /><br /><b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
$ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . IMAGES . "avatars/nopic.gif\" height=\"40\" border=\"0\" /><br />" : "") . $name . '</a>';
if (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
$ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
}
}
if ($ausgabe == "") {
if ($sp_settings['grss_djon'] == 1 && !($sp_settings['grss_week'] == 1 && $feld_id < 169) && (sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
$ausgabe .= "<a href='javascript:;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=add&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;'>" . $locale['grsp121'] . "</a>";
} else {
$ausgabe .= ($sp_settings['grss_djpic'] == 1 && $sp_settings['grss_autodjpic'] == 1 ? "<img src=\"" . INFUSIONS . "gr_sendeplan/autodj.gif\" height=\"40\" border=\"0\" /><br />" : "") . $locale['grsp120'];
}
}
if ($sp_settings['grss_replay'] == 1 && $feld_id > 168 && (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN)) {
$info_result = dbquery("SELECT * FROM " . DB_GR_SENDEPLAN_REPLAY . " WHERE grsr_re_id='" . $feld_id . "'");
if (dbrows($info_result) != 0) {
$ausgabe .= '<form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_re_delete" value="' . $locale['grsp140'] . '" class="button" style="width:80px;" /></form>';
}
}
return $ausgabe;
}
示例3: delete_sitelinks
/**
* SQL Delete Site Link Action
* @param $link_id
* @return bool|mixed|null|PDOStatement|resource
*/
public static function delete_sitelinks($link_id)
{
$result = NULL;
if (isnum($link_id)) {
$data = dbarray(dbquery("SELECT link_order FROM " . DB_SITE_LINKS . " " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . " link_id='" . $_GET['link_id'] . "'"));
$result = dbquery("UPDATE " . DB_SITE_LINKS . " SET link_order=link_order-1 " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . " link_order>'" . $data['link_order'] . "'");
if ($result) {
$result = dbquery("DELETE FROM " . DB_SITE_LINKS . " WHERE link_id='" . $_GET['link_id'] . "'");
}
return $result;
}
return $result;
}
示例4: __construct
public function __construct()
{
global $admin_pages, $aidlink;
$this->admin_pages = $admin_pages;
$this->locale = fusion_get_locale('', LOCALE . LOCALESET . "admin/main.php");
$this->admin_sections = array(0 => $GLOBALS['locale']['ac00'], 1 => $GLOBALS['locale']['ac01'], 2 => $GLOBALS['locale']['ac02'], 3 => $GLOBALS['locale']['ac03'], 4 => $GLOBALS['locale']['ac04'], 5 => $GLOBALS['locale']['ac05']);
$this->current_page = self::_currentPage();
// Dashboard breadcrumb
add_breadcrumb(array('link' => ADMIN . 'index.php' . $aidlink . '&pagenum=0', 'title' => $GLOBALS['locale']['ac10']));
$acTab = isset($_GET['pagenum']) && isnum($_GET['pagenum']) ? $_GET['pagenum'] : $this->_isActive();
if ($acTab != 0 && $acTab <= 5) {
add_breadcrumb(array('link' => ADMIN . $aidlink . "&pagenum=" . $acTab, 'title' => $GLOBALS['locale']['ac0' . $acTab]));
}
}
示例5: filter_show
function filter_show($row_start_key = false, $items_per_page_key = false)
{
if (isset($_GET[$row_start_key]) || isset($_GET[$items_per_page_key])) {
$condition = '';
if ($_GET[$items_per_page_key]) {
// WHEN show is available we set to rowstat, and show items.
$condition = " LIMIT ";
$condition .= isset($_GET[$row_start_key]) && isnum($_GET[$row_start_key]) ? stripinput($_GET[$row_start_key]) : 0;
if (isset($_GET[$items_per_page_key]) && isnum($_GET[$items_per_page_key])) {
$condition .= "," . stripinput($_GET[$items_per_page_key]);
}
}
return $condition;
}
}
示例6: ratings_forum
function ratings_forum($thread_id)
{
global $settings, $locale;
$text = "";
if ($settings['forum_ratings'] && isnum($thread_id)) {
$result = dbquery("SELECT SUM(rating_vote) AS sum, COUNT(rating_vote) AS count\r\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='F' AND rating_item_id='" . (int) $thread_id . "'");
$data = dbarray($result);
$rating = $data['count'] ? $data['sum'] / $data['count'] : 0;
if ($rating > 0) {
$rounded = round($rating);
$text = "<img src='" . IMAGES . "ratings/" . $rounded . ".gif' alt='" . $locale['r130'] . $rounded . "' title='" . $locale['r130'] . round($rating, 2) . " " . sprintf($locale['r135'], $data['count']) . "' style='vertical-align:middle; border: 0;' />\n";
}
}
return $text;
}
示例7: display_news
public function display_news()
{
if (isset($_GET['readmore']) && isnum($_GET['readmore'])) {
// Item Result
$info = $this->set_NewsItemInfo($_GET['readmore']);
render_news_item($info);
} elseif (isset($_GET['cat_id']) && isnum($_GET['cat_id'])) {
// Category Result
$info = $this->set_NewsCatInfo($_GET['cat_id']);
render_main_news($info);
} else {
// All Results
$info = $this->set_NewsInfo();
render_main_news($info);
}
}
示例8: __construct
public function __construct()
{
global $locale, $admin_pages, $aidlink;
@(list($title) = dbarraynum(dbquery("SELECT admin_title FROM " . DB_ADMIN . " WHERE admin_link='" . FUSION_SELF . "'")));
set_title($locale['global_123'] . $locale['global_201'] . ($title ? $title . $locale['global_200'] : ""));
$this->admin_pages = $admin_pages;
// generate core sections
$this->admin_sections = array(0 => $locale['ac00'], 1 => $locale['ac01'], 2 => $locale['ac02'], 3 => $locale['ac03'], 4 => $locale['ac04'], 5 => $locale['ac05']);
$this->current_page = self::_currentPage();
// Dashboard breadcrumb
add_breadcrumb(array('link' => ADMIN . 'index.php' . $aidlink . '&pagenum=0', 'title' => $locale['ac10']));
$activetab = isset($_GET['pagenum']) && isnum($_GET['pagenum']) ? $_GET['pagenum'] : $this->_isActive();
if ($activetab != 0 && $activetab <= 5) {
add_breadcrumb(array('link' => ADMIN . $aidlink . "&pagenum=" . $activetab, 'title' => $locale['ac0' . $activetab]));
}
}
示例9: weblink_admin_subsubcats
function weblink_admin_subsubcats($id)
{
global $aidlink, $locale;
$result = dbquery("SELECT weblink_cat_id, weblink_cat_name FROM " . DB_WEBLINK_CATS . " WHERE weblink_cat_parent='" . (int) $id . "' ORDER BY weblink_cat_name");
$sublist = "";
while ($data = dbarray($result)) {
if (!isset($_GET['weblink_cat_id']) || !isnum($_GET['weblink_cat_id'])) {
$_GET['weblink_cat_id'] = 0;
}
if ($data['weblink_cat_id'] == $_GET['weblink_cat_id']) {
$p_img = "off";
$div = "";
} else {
$p_img = "on";
$div = "style='display:none'";
}
$sublist .= "<tr>\n";
$sublist .= "<td class='tbl2'>--" . $data['weblink_cat_name'] . "</td>\n";
$sublist .= "<td class='tbl2' align='right'><img src='" . get_image("panel_{$p_img}") . "' alt='' name='b_" . $data['weblink_cat_id'] . "' onclick=\"javascript:flipBox('" . $data['weblink_cat_id'] . "')\" /></td>\n";
$sublist .= "</tr>\n";
$result2 = dbquery("SELECT weblink_id, weblink_name, weblink_url FROM " . DB_WEBLINKS . " WHERE weblink_cat='" . $data['weblink_cat_id'] . "' ORDER BY weblink_name");
if (dbrows($result2)) {
$sublist .= "<tr>\n<td colspan='2'>\n";
$sublist .= "<div id='box_" . $data['weblink_cat_id'] . "'" . $div . ">\n";
$sublist .= "<table cellpadding='0' cellspacing='0' width='100%'>\n";
while ($data2 = dbarray($result2)) {
$sublist .= "<tr>\n";
$sublist .= "<td class='tbl'><a href='" . $data2['weblink_url'] . "' target='_blank'>" . $data2['weblink_name'] . "</a></td>\n";
$sublist .= "<td width='75' class='tbl'><a href='" . FUSION_SELF . $aidlink . "&action=edit&weblink_cat_id=" . $data['weblink_cat_id'] . "&weblink_id=" . $data2['weblink_id'] . "'>" . $locale['533'] . "</a> -\n";
$sublist .= "<a href='" . FUSION_SELF . $aidlink . "&action=delete&weblink_cat_id=" . $data['weblink_cat_id'] . "&weblink_id=" . $data2['weblink_id'] . "' onclick=\"return confirm('" . $locale['550'] . "');\">" . $locale['534'] . "</a></td>\n";
$sublist .= "</tr>\n";
}
$sublist .= "</table>\n</div>\n</td>\n</tr>\n";
} else {
$sublist .= "<tr>\n<td colspan='2'>\n";
$sublist .= "<div id='box_" . $data['weblink_cat_id'] . "' style='display:none'>\n";
$sublist .= "<table width='100%' cellspacing='0' cellpadding='0'>\n<tr>\n";
$sublist .= "<td class='tbl'>" . $locale['535'] . "</td>\n";
$sublist .= "</tr>\n</table>\n</div>\n";
}
$sublist .= weblink_admin_subsubcats($data['weblink_cat_id']);
}
$sublist .= "</tr>\n";
return $sublist;
}
示例10: download_admin_subcats
function download_admin_subcats($id)
{
global $aidlink, $locale;
$sublist = "";
$result = dbquery("SELECT download_cat_id, download_cat_name FROM " . DB_DOWNLOAD_CATS . " WHERE download_cat_parent='" . (int) $id . "' ORDER BY download_cat_name");
if (dbrows($result)) {
while ($data = dbarray($result)) {
if (!isset($_GET['download_cat_id']) || !isnum($_GET['download_cat_id'])) {
$_GET['download_cat_id'] = 0;
}
if ($data['download_cat_id'] == $_GET['download_cat_id']) {
$p_img = "off";
$div = "";
} else {
$p_img = "on";
$div = "style='display:none'";
}
$sublist .= "<tr>\n";
$sublist .= "<td class='tbl2'>-" . $data['download_cat_name'] . "</td>\n";
$sublist .= "<td class='tbl2' style='text-align:right;'><img src='" . get_image("panel_{$p_img}") . "' name='b_" . $data['download_cat_id'] . "' alt='' onclick=\"javascript:flipBox('" . $data['download_cat_id'] . "')\" /></td>\n";
$sublist .= "</tr>\n";
$result2 = dbquery("SELECT download_id, download_title, download_url, download_file FROM " . DB_DOWNLOADS . " WHERE download_cat='" . $data['download_cat_id'] . "' ORDER BY download_title");
if (dbrows($result2) != 0) {
$sublist .= "<tr>\n<td colspan='2'>\n";
$sublist .= "<div id='box_" . $data['download_cat_id'] . "'" . $div . ">\n";
$sublist .= "<table cellpadding='0' cellspacing='0' style='width:100%;'>\n";
while ($data2 = dbarray($result2)) {
if (!empty($data2['download_file']) && file_exists(DOWNLOADS . $data2['download_file'])) {
$download_url = DOWNLOADS . $data2['download_file'];
} elseif (!strstr($data2['download_url'], "http://") && !strstr($data2['download_url'], "../")) {
$download_url = BASEDIR . $data2['download_url'];
} else {
$download_url = $data2['download_url'];
}
$sublist .= "<tr>\n<td class='tbl1'><a href='" . $download_url . "' target='_blank'>" . $data2['download_title'] . "</a></td>\n";
$sublist .= "<td class='tbl1' style='text-align:right;width:100px;'><a href='" . FUSION_SELF . $aidlink . "&action=edit&download_cat_id=" . $data['download_cat_id'] . "&download_id=" . $data2['download_id'] . "'>" . $locale['442'] . "</a> -\n";
$sublist .= "<a href='" . FUSION_SELF . $aidlink . "&action=delete&download_cat_id=" . $data['download_cat_id'] . "&download_id=" . $data2['download_id'] . "' onclick=\"return confirm('" . $locale['460'] . "');\">" . $locale['443'] . "</a></td>\n";
$sublist .= "</tr>\n";
}
$sublist .= "</table>\n</div>\n</td>\n</tr>\n";
}
}
}
return $sublist;
}
示例11: openform
/**
* @param $form_name
* @param $method - 'post' or 'get'
* @param $action_url - form current uri
* @param array $options :
* form_id = default as form_name
* class = default empty
* enctype = true or false , set true to allow file upload
* max_tokens = store into session number of tokens , default as 1.
* @return string
*/
function openform($form_name, $method, $action_url, array $options = array())
{
global $defender;
$method = strtolower($method) == 'post' ? 'post' : 'get';
$options = array('form_id' => !empty($options['form_id']) ? $options['form_id'] : $form_name, 'class' => !empty($options['class']) ? $options['class'] : '', 'enctype' => !empty($options['enctype']) && $options['enctype'] == TRUE ? TRUE : FALSE, 'max_tokens' => !empty($options['max_tokens']) && isnum($options['max_tokens']) ? $options['max_tokens'] : 1);
$class = "";
if (!$defender->safe()) {
$class .= "class='warning " . $options['class'] . "' ";
} elseif (!empty($options['class'])) {
$class .= "class='" . $options['class'] . "'";
}
$action_prefix = fusion_get_settings("site_seo") && !defined("ADMIN_PANEL") ? FUSION_ROOT : "";
$html = "<form name='" . $form_name . "' id='" . $options['form_id'] . "' method='" . $method . "' action='" . $action_prefix . $action_url . "' " . $class . " " . ($options['enctype'] ? "enctype='multipart/form-data'" : '') . " >\n";
if ($method == 'post') {
$token = $defender->generate_token($options['form_id'], $options['max_tokens']);
$html .= "<input type='hidden' name='fusion_token' value='" . $token . "' />\n";
$html .= "<input type='hidden' name='form_id' value='" . $options['form_id'] . "' />\n";
}
return $html;
}
示例12: whoishere_observer
function whoishere_observer($forum_place)
{
global $userdata;
$user_id = iMEMBER ? $userdata['user_id'] : USER_IP;
$forum_id = "";
$thread_id = "";
if ($forum_place == "index") {
$forum_id = 0;
$thread_id = 0;
} elseif ($forum_place == "forum" && isset($_GET['forum_id']) && isnum($_GET['forum_id'])) {
$forum_id = $_GET['forum_id'];
$thread_id = 0;
} elseif ($forum_place == "thread" && isset($_GET['thread_id']) && isnum($_GET['thread_id'])) {
list($forum_id) = dbarraynum(dbquery("SELECT forum_id FROM " . DB_THREADS . " WHERE thread_id='" . (int) $_GET['thread_id'] . "'"));
$thread_id = $_GET['thread_id'];
}
if (isnum($forum_id) && isnum($thread_id)) {
dbquery("REPLACE INTO " . DB_FORUM_OBSERVER . " SET user_id='" . $user_id . "', forum_id='" . $forum_id . "', thread_id='" . $thread_id . "', age='" . time() . "'");
}
dbquery("DELETE FROM " . DB_FORUM_OBSERVER . " WHERE age < (" . time() . "-5*60)");
}
示例13: openform
function openform($form_name, $form_id, $method, $action, $array = false)
{
global $defender;
if (!is_array($array)) {
$class = '';
$enctype = '';
$downtime = 10;
$notice = 1;
} else {
$class = array_key_exists('class', $array) && $array['class'] ? $array['class'] : '';
$enctype = array_key_exists('enctype', $array) && $array['enctype'] == 1 ? 1 : 0;
$downtime = array_key_exists('downtime', $array) && isnum($array['downtime']) ? $array['downtime'] : 10;
$notice = array_key_exists('notice', $array) && isnum($array['notice']) ? $array['notice'] : 1;
}
$html = "<form name='" . $form_name . "' id='" . $form_id . "' method='" . $method . "' action='" . $action . "' class='" . (defined('FUSION_NULL') ? 'warning' : '') . " {$class}' " . ($enctype ? "enctype='multipart/form-data'" : '') . " >\n";
$html .= generate_token($form_name, $downtime);
if (defined('FUSION_NULL') && $notice) {
echo $defender->showNotice();
}
return $html;
}
示例14: form_photosize
function form_photosize($title, $input_name, $input_id, $input_value_width, $input_value_height, $array = false)
{
$title = isset($title) && !empty($title) ? $title : "";
$title2 = isset($title) && !empty($title) ? $title : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = isset($input_name) && !empty($input_name) ? stripinput($input_name) : "";
$input_id = isset($input_id) && !empty($input_id) ? stripinput($input_id) : "";
if (!is_array($array)) {
$inline = '';
$placeholder = 'px';
$deactivate = '';
$required = 0;
$error_text = '';
} else {
$inline = array_key_exists('rowstart', $array) ? 1 : 0;
$placeholder = array_key_exists('placeholder', $array) ? $array['placeholder'] : 'px';
$deactivate = array_key_exists('deactivate', $array) ? $array['deactivate'] : "";
$class = array_key_exists('class', $array) ? "class='" . $array['class'] . "'" : "";
$required = array_key_exists('required', $array) && $array['required'] == 1 ? 1 : 0;
$deactivate = '';
$error_text = array_key_exists("error_text", $array) ? $array['error_text'] : "";
}
$html = "<div id='{$input_id}-field' class='form-group m-b-0 has-feedback'>\n";
$html .= $title ? "<label class='control-label " . ($inline ? "col-xs-3 col-sm-3 col-md-3 col-lg-3" : '') . "' for='{$input_id}'>{$title} " . ($required == 1 ? "<span class='required'>*</span>" : '') . "</label>\n" : '';
$html .= $inline ? "<div class='col-xs-9 col-sm-9 col-md-9 col-lg-9'>\n" : "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12 p-l-0 form-horizontal'>\n";
$html .= "<div class='form-group m-b-0 has-feedback col-sm-6 col-md-6 col-lg-6 m-r-10'>";
$html .= "<input type='text' class='form-control input-sm {$class}' name='" . $input_name . "_w' id='" . $input_id . "' value='{$input_value_width}' placeholder='width (" . $placeholder . ")' " . ($deactivate == "1" && isnum($deactivate) ? "readonly" : "") . ">\n";
$html .= "<div class='form-control-feedback'><i class='glyphicon glyphicon-resize-horizontal'></i></div>\n";
$html .= "<div id='{$input_id}-help' style='display:inline-block !important;'></div>";
$html .= "</div>\n";
$html .= "<div class='form-group m-b-0 has-feedback col-sm-6 col-md-6 col-lg-6'>";
$html .= "<input type='text' class='form-control input-sm {$class}' name='" . $input_name . "_h' id='" . $input_id . "' value='{$input_value_height}' placeholder='height (" . $placeholder . ")' " . ($deactivate == "1" && isnum($deactivate) ? "readonly" : "") . ">\n";
$html .= "<div class='form-control-feedback'><i class='glyphicon glyphicon-resize-vertical'></i></div>\n";
$html .= "<div id='{$input_id}-help' style='display:inline-block !important;'></div>";
$html .= "</div>\n";
$html .= "</div></div>\n";
$html .= "<input type='hidden' name='def['" . $input_name . "_w']' value='[type=text],[title={$title2}],[id={$input_id}],[required={$required}],[safemode=0]" . ($error_text ? ",[error_text={$error_text}]" : '') . "' readonly />";
$html .= "<input type='hidden' name='def['" . $input_name . "_h']' value='[type=text],[title={$title2}],[id={$input_id}],[required={$required}],[safemode=0]" . ($error_text ? ",[error_text={$error_text}]" : '') . "' readonly />";
return $html;
}
示例15: post_mood
public function post_mood()
{
$response = FALSE;
// this is general single static output
if (isset($_POST['post_mood']) && isnum($_POST['post_mood'])) {
// if is a valid mood
// insert into post notify
$notify_data = array('post_id' => form_sanitizer($_POST['post_id'], 0, 'post_id'), 'notify_mood_id' => intval($_POST['post_mood']), 'notify_datestamp' => time(), 'notify_user' => form_sanitizer($_POST['post_author'], 0, 'post_author'), 'notify_sender' => fusion_get_userdata('user_id'), 'notify_status' => 1);
if (\defender::safe() && dbcount('(mood_id)', DB_FORUM_MOODS, "mood_id='" . $notify_data['notify_mood_id'] . "'") && !$this->mood_exists($notify_data['notify_sender'], $notify_data['notify_mood_id'], $notify_data['post_id'])) {
dbquery_insert(DB_POST_NOTIFY, $notify_data, 'save');
$response = TRUE;
}
} elseif (isset($_POST['unpost_mood']) && isnum($_POST['unpost_mood'])) {
// if is a valid mood
// insert into post notify
$notify_data = array('post_id' => form_sanitizer($_POST['post_id'], 0, 'post_id'), 'notify_mood_id' => intval($_POST['unpost_mood']), 'notify_user' => form_sanitizer($_POST['post_author'], 0, 'post_author'), 'notify_sender' => fusion_get_userdata('user_id'));
if (\defender::safe() && dbcount('(mood_id)', DB_FORUM_MOODS, "mood_id='" . $notify_data['notify_mood_id'] . "'") && $this->mood_exists($notify_data['notify_sender'], $notify_data['notify_mood_id'], $notify_data['post_id'])) {
dbquery("DELETE FROM " . DB_POST_NOTIFY . " WHERE post_id=" . $notify_data['post_id'] . "\n AND notify_mood_id=" . $notify_data['notify_mood_id'] . "\n AND notify_user=" . $notify_data['notify_user'] . "\n AND notify_sender=" . $notify_data['notify_sender']);
$response = TRUE;
}
}
return (bool) $response;
}