plugins_usercountd.php this is the php could you look at it thanks
PHP Code:
<?php
/* ====================================================================== *\
|| ||
|| User Countdown AddOn for vBulletin ||
|| (c)2006 Michael "Hellcat" Hengstmann ||
|| [email]hellcat@hellcat.net[/email] ||
|| -------------------------------------------------------------------- ||
|| You may use this script for free, but not redistribute ||
|| without giving the propper credits! ||
|| ||
\* ====================================================================== */
// \\
// ========== Script Version: 1.10 ========== \\
// \\
global $vbulletin, $permissions;
if ( $THIS_HOOK == "profile_fetch_profilefields" )
{
if ( ( $profilefield["title"] == "User Countdown" ) AND ( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) )
{
$profilefield["type"] = "";
$cdsettings = unserialize( str_replace( """, '"', $vbulletin->userinfo[$profilefieldname] ) );
$oprofilefieldtitle = $profilefield["title"];
$oprofilefieldname = $profilefieldname;
$oprofilefielddescription = $profilefield["description"];
$radiobits = "";
$options = array( "Yes" => $vbphrase["countdown_on"], "No" => $vbphrase["countdown_off"] );
$profilefield[title] = $vbphrase["countdown_enable"];
$profilefield[description] = $vbphrase["countdown_enable_desc"];
$profilefieldname = $oprofilefieldname . "_enable";
foreach ($options AS $vkey => $option)
{
$key = $vkey;
$val = $option;
if ( $key == $cdsettings["enabled"] ) { $checked = 'checked = "checked"'; } else { $checked = ""; }
eval('$radiobits .= "' . fetch_template('userfield_radio_option') . '";');
}
eval('$radio_enable = "' . fetch_template('userfield_radio') . '";');
$selectbits = "";
$profilefield["title"] = $vbphrase["day"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_day";
for ( $i = 1; $i <= 31; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;
if ( $val == $cdsettings["day"] ) { $selected = "selected"; } else { $selected = ""; }
eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$dayselect = "' . fetch_template('userfield_select') . '";');
$selectbits = "";
$profilefield["title"] = $vbphrase["month"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_month";
for ( $i = 1; $i <= 12; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;
if ( $val == $cdsettings["month"] ) { $selected = "selected"; } else { $selected = ""; }
eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$monthselect = "' . fetch_template('userfield_select') . '";');
$selectbits = "";
$profilefield["title"] = $vbphrase["year"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_year";
for ( $i = date("Y"); $i <= 2020; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;
if ( $val == $cdsettings["year"] ) { $selected = "selected"; } else { $selected = ""; }
eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$yearselect = "' . fetch_template('userfield_select') . '";');
$selectbits = "";
$profilefield["title"] = $vbphrase["countdown_hour"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_hour";
for ( $i = 0; $i <= 23; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;
if ( $val == $cdsettings["hour"] ) { $selected = "selected"; } else { $selected = ""; }
eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$hourselect = "' . fetch_template('userfield_select') . '";');
$selectbits = "";
$profilefield["title"] = $vbphrase["countdown_minute"];
$profilefield["description"] = "";
$profilefieldname = $oprofilefieldname . "_minute";
for ( $i = 0; $i <= 59; $i++ )
{
$key = trim( strval( $i ) );
$val = $key;
if ( $val == $cdsettings["minute"] ) { $selected = "selected"; } else { $selected = ""; }
eval('$selectbits .= "' . fetch_template('userfield_select_option') . '";');
}
eval('$minuteselect = "' . fetch_template('userfield_select') . '";');
$profilefield["title"] = $vbphrase["countdown_event"];
$profilefield["description"] = $vbphrase["countdown_event_desc"];
$profilefieldname = $oprofilefieldname . "_event";
$bbuserinfo[$profilefieldname] = $cdsettings["event"];
$profilefield["size"] = "48";
$profilefield["maxlength"] = "128";
eval('$text_event = "' . fetch_template('userfield_textbox') . '";');
$text_event = str_replace( 'value=""', 'value="' . $cdsettings["event"] . '"', $text_event );
$profilefield["title"] = $vbphrase["countdown_overmsg"];
$profilefield["description"] = $vbphrase["countdown_overmsg_desc"];
$profilefieldname = $oprofilefieldname . "_overmsg";
$bbuserinfo[$profilefieldname] = $cdsettings["overmsg"];
$profilefield["size"] = "48";
$profilefield["maxlength"] = "128";
eval('$text_overmsg = "' . fetch_template('userfield_textbox') . '";');
$text_overmsg = str_replace( 'value=""', 'value="' . $cdsettings["overmsg"] . '"', $text_overmsg );
$profilefield["title"] = $vbphrase["countdown_title"];
$profilefieldname = $oprofilefieldname;
$profilefield["description"] = $vbphrase["countdown_desc"];
$wrapper_template = 'userfield_countdown';
$fields = array('radio_enable', 'text_event', 'text_overmsg', 'dayselect', 'monthselect', 'yearselect', 'hourselect', 'minuteselect');
foreach ($fields AS $field)
{
$$field = str_replace('userfield', 'cdsettings', $$field);
} } if ( ( $profilefield["title"] == "User Countdown" ) AND !( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) ) {
$profilefield["type"] = "";
$tempcustom = "";
}
}
// ********************************************************************** \\
if ( ( $THIS_HOOK == "profile_updateoptions" ) AND ( $permissions["hc_usercountdown"] & $vbulletin->bf_ugp["hc_usercountdown"]["canusecountdown"] ) )
{
$vbulletin->input->clean_array_gpc('p', array( "countdownuserfield" => TYPE_STR,
"cdsettings" => TYPE_ARRAY ));
$cdsettings = $vbulletin->GPC["cdsettings"];
$cdprofilefield = $vbulletin->GPC["countdownuserfield"];
$cddata["enabled"] = $cdsettings[$cdprofilefield . "_enable"];
$cddata["day"] = $cdsettings[$cdprofilefield . "_day"];
$cddata["month"] = $cdsettings[$cdprofilefield . "_month"];
$cddata["year"] = $cdsettings[$cdprofilefield . "_year"];
$cddata["hour"] = $cdsettings[$cdprofilefield . "_hour"];
$cddata["minute"] = $cdsettings[$cdprofilefield . "_minute"];
$cddata["event"] = $cdsettings[$cdprofilefield . "_event"];
$cddata["overmsg"] = $cdsettings[$cdprofilefield . "_overmsg"];
$vbuserfields[$cdprofilefield] = serialize( $cddata );
$vbuserfields[$cdprofilefield . "_set"] = "1";
$vbuserfields[$cdprofilefield . "_opt"] = "";
$userdata->set_userfields( $vbuserfields );
}
// ********************************************************************** \\
if ( $THIS_HOOK == "postbit_display_complete" )
{
if ( strlen($post["signature"]) > 0 )
{
$cdfield = "field" . $vbulletin->options["countdownfield"];
$query = $vbulletin->db->query_read( "SELECT $cdfield FROM " . TABLE_PREFIX . "userfield WHERE userid='" . $post["userid"] . "';" );
$result = mysql_fetch_array( $query );
$cddata = unserialize( str_replace( """, '"', $result[$cdfield] ) );
if ( $cddata["enabled"] == "Yes" )
{
require_once( "./includes/class_bbcode.php" );
require_once( "./includes/functions_newpost.php" );
$vbulletin->cdbbcode_parse =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$eta = mktime ( intval( $cddata["hour"] ), intval( $cddata["minute"] ), 0, intval( $cddata["month"] ), intval( $cddata["day"] ), intval( $cddata["year"] ) );
$tremain = $eta - time();
if ( $tremain > 0 )
{
$t = $tremain;
$remain["days"] = intval ( $t / 86400 );
$t = $t - ( $remain["days"] * 86400 );
$remain["hours"] = intval ( $t / 3600 );
$t = $t - ( $remain["hours"] * 3600 );
$remain["minutes"] = intval ( $t / 60 );
$counter = $remain["minutes"] . $vbphrase["countdown_minutes"];
if ( ( $remain["hours"] != 0 ) OR ( $remain["days"] != 0 ) )
{
$counter = $remain["hours"] . $vbphrase["countdown_hours"] . " " . $counter;
}
if ( $remain["days"] != 0 )
{
$counter = $remain["days"] . $vbphrase["countdown_days"] . " " . $counter;
}
} else {
$counter = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["overmsg"]), 'nonforum');
}
$event = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["event"]), 'nonforum');
eval('$counterhtml = "' . fetch_template('usercountdown_display') . '";');
$sig = $post['signature'] . $counterhtml;
$post['signature'] = $sig;
}
}
}
?>