예제 #1
0
function gowalla_spotter()
{
    //set SpotID and execute if there is one
    $post_id = get_the_ID();
    $spot_id = get_post_meta($post_id, "Gowalla", true);
    if ($spot_id != "") {
        // get JSON from Gowalla with cURL
        // create a new cURL resource
        $ch = curl_init();
        // set URL and other appropriate options
        curl_setopt($ch, CURLOPT_URL, "http://api.gowalla.com/spots/{$spot_id}");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json;charset=utf-8", "Accept: application/json"));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        // grab URL and store it
        $json = curl_exec($ch);
        // close cURL resource, and free up system resources
        curl_close($ch);
        //decode json array
        $json = json_decode($json);
        //print headline with appropriate links
        $output = "";
        $output .= "<b>Latest activity at <a href=\"http://gowalla.com/spots/" . $spot_id . "\">" . get_the_title() . "</a> from <a href=\"http://gowalla.com\">Gowalla</a> </b><br/>";
        // print the activity list: parse every item and write it on the page (or skip if there are no items)
        foreach ($json->last_checkins as $checkin) {
            $output .= sprintf('<img src="%s" alt="" width="25" height="25" /> <a href="%s">%s %s</a> %s (%s)<br />', $checkin->user->image_url, 'http://gowalla.com' . $checkin->user->url, $checkin->user->first_name, $checkin->user->last_name, $checkin->message, nicetime($checkin->created_at));
        }
        echo $output;
    }
}
예제 #2
0
function mysql2AssocArray($mysqlPostRow)
{
    global $db, $userPosition, $forumId, $usersForumId;
    $postId = $mysqlPostRow['id'];
    // Times
    $htmlDatetime = date('c', $mysqlPostRow['post_time']);
    $readableTime = date('D, d M Y H:i:s', $mysqlPostRow['post_time']);
    $niceTime = nicetime($mysqlPostRow['post_time']);
    // User and message
    $forumUser = html_entity_decode($mysqlPostRow['sender']);
    $forumUser = smilify($forumUser, $forumUser);
    $forumMessage = URL2link(smilify(nl2br(html_entity_decode($mysqlPostRow['message'])), $forumUser));
    // ip address, delete, edit button
    $headerActions = $userPosition == 'Webmaster' ? decode_ip($mysqlPostRow['ipaddress']) . ' 
        <a class="forum-post-delete" style="color:black;" title="Delete post" href="forum/delete/' . $postId . '">
            <i class="fa fa-trash-o"></i> <span class="sr-only">Delete</span>
        </a>' : '';
    if ($mysqlPostRow['users_forum_id'] == $usersForumId || $userPosition == 'Webmaster') {
        $headerActions .= '
            <a class="forum-post-edit" style="color:black;" title="Edit post" href="forum/edit/' . $postId . '">
                <i class="fa fa-pencil"></i> <span class="sr-only">Edit</span>
            </a>';
    }
    // Likes
    $likeCount = mysqli_query($db, "SELECT count(1) c FROM forum_plusone WHERE message = {$postId} LIMIT 1");
    $likeCount = mysqli_fetch_array($likeCount)['c'];
    if (mysqli_num_rows(mysqli_query($db, "SELECT 1 FROM forum_plusone WHERE message = {$postId} AND cookie = '{$usersForumId}' LIMIT 1"))) {
        $likedClass = 'liked';
        $likeTitle = 'Approved';
    } else {
        $likedClass = 'not-liked';
        $likeTitle = 'Approve Post';
    }
    return array('id' => $mysqlPostRow['id'], 'parentPostId' => $mysqlPostRow['parent_id'], 'htmlDatetime' => $htmlDatetime, 'readableTime' => $readableTime, 'niceTime' => $niceTime, 'forumUser' => $forumUser, 'forumMessage' => $forumMessage, 'headerActions' => $headerActions, 'likeCount' => $likeCount, 'likedClass' => $likedClass, 'likeTitle' => $likeTitle);
}
 /**
  * display widget
  */
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     global $wpdb, $user_ID, $table_prefix, $blog_id;
     $userid = $instance['snorl'];
     $result = wordbooker_get_cache($userid);
     echo $before_widget;
     $name = $result->name;
     if (strlen($instance['dname']) > 0) {
         $name = $instance['dname'];
     }
     $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo '<br /><div class="facebook_picture" align="center">';
     echo '<a href="' . $result->url . '" target="facebook">';
     echo '<img src="' . $result->pic . '" alt=" FB photo for ' . $name . '" /></a>';
     echo '</div>';
     if ($result->status) {
         $current_offset = 0;
         #	$current_offset = get_option('gmt_offset');
         echo '<p><br /><a href="' . $result->url . '">' . $name . '</a> : ';
         echo '<i>' . $result->status . '</i><br />';
         if ($instance['df'] == 'fbt') {
             echo '(' . nicetime($result->updated + 3600 * $current_offset) . ').';
         } else {
             echo '(' . date($instance['df'], $result->updated + 3600 * $current_offset) . ').';
         }
     }
     echo "</p>" . $after_widget;
 }
예제 #4
0
function custom_comments($comment = false, $args = false, $depth = false, $post = false)
{
    $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $depth;
    ?>
	<li id="comment-<?php 
    comment_ID();
    ?>
" <?php 
    comment_class();
    ?>
>
	    <?php 
    //#FIXME: aşağıdaki komutlar wordpress in fonksiyonlarını kullanmalı ya da en azından fonksiyon tanımlanmalı.
    /*
    		$queçok güzelry = "SELECT comment_arti_eksi FROM  $wpdb->comment_arti_eksi WHERE comment_ID=" . get_comment_ID() . ";";
    		$user_count = $wpdb->get_var($wpdb->prepare($query));
    		echo '<p>User count is ' . $user_count . '</p>';
    */
    $query = "SELECT comment_arti_eksi FROM wp_comment_arti_eksi WHERE comment_ID = " . get_comment_ID() . ";";
    $result = mysql_query($query);
    $row = mysql_fetch_assoc($result);
    //print '<div class="commentHolder" style="position:relative;';
    if ($row[comment_arti_eksi] == '+') {
        print '<div class="commentHolderArti" style="position:relative">';
        print '<img width="25" src="' . get_site_url() . '/wp-content/themes/artilarieksileri/images/arti.png">';
    } else {
        print '<div class="commentHolderEksi" style="position:relative">';
        print '<img width="25" src="' . get_site_url() . '/wp-content/themes/artilarieksileri/images/eksi.png">';
    }
    //print "<font style=\"font-size:20px\">$row[comment_arti_eksi]</font>";
    //$allmiles=$wpdb->get
    //echo '<p>Total miles is '.$allmiles . '</p>';
    ?>

	    <!--<div class="commentContent">-->
		<?php 
    comment_text();
    ?>
		
		<span style="position:absolute;right:0">
		    <?php 
    commenter_link();
    ?>
  
		    <?php 
    print nicetime(get_comment_date('Y-n-j') . ' ' . get_comment_time('H:i'));
    ?>
		</span>

		<?php 
    if ($comment->comment_approved == '0') {
        _e("<p class='unapproved'>Your comment is awaiting moderation.</p>\n", 'moov');
    }
    ?>
	    <!--</div>-->
		  <?php 
    php;
    ?>
		</div>

<?php 
}
예제 #5
0
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY tgl DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '"><span>' . $gambar . '' . limitwords($data[1], 8) . '...</span></a></li>';
    }
    echo "</ul>";
    echo '</div>';
} else {
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY tgl DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $nicetime = nicetime($data['tgl']);
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '">' . $gambar . '' . limitwords($data[1], 8) . '...<br>
' . $nicetime . '
</a></li>';
    }
    echo "</ul>";
    echo '</div>';
}
$out = ob_get_contents();
ob_end_clean();
예제 #6
0
function process_lifestream_item($row)
{
    $row['title'] = str_replace("–", "–", $row['title']);
    $row['title'] = str_replace("—", "–", $row['title']);
    $text = $row['title'];
    $row['originaltext'] = $row['title'];
    $row['content'] = twitterFormat($text);
    if (!$row['source']) {
        $row['source'] = $row['type'];
    }
    switch ($row['type']) {
        case "lastfm":
            $icon = IMAGE_ROOT . 'silk/music.png';
            break;
        case "gaming":
            $icon = IMAGE_ROOT . 'silk/joystick.png';
            if ($row['source'] == "Champions Online") {
                $icon = IMAGE_ROOT . 'games/ChampionsOnline.png';
                $row['url'] = "http://www.champions-online.com/character_profiles/user_characters/Jascain";
            } elseif ($row['source'] == "HeroStats") {
                $icon = IMAGE_ROOT . 'games/city_of_heroes/Hero.png';
                $row['small_icon'] = IMAGE_ROOT . 'games/cityofheroes.png';
                $row['url'] = "http://cit.cohtitan.com/profile/13610";
            } elseif ($row['source'] == "Raptr" && preg_match('#Champions Online! #', $text)) {
                $row['content'] .= "#";
            } elseif ($row['source'] == "XLN Live Integration") {
                $icon = IMAGE_ROOT . 'silk/controller.png';
                $row['url'] = "http://live.xbox.com/en-GB/profile/profile.aspx?pp=0&GamerTag=Jascain";
            } elseif (preg_match('#\\#wow#', $text)) {
                $row['source'] = "World of Warcraft";
                $icon = IMAGE_ROOT . 'games/world_of_warcraft.png';
            }
            break;
        case "steam":
            $icon = IMAGE_ROOT . 'games/steam.png';
            $row['small_image'] = IMAGE_ROOT . 'games/steam_small.png';
            #$row['url'] = "http://steamcommunity.com/id/aquarion/";
            $row['title'] = "Achieved: " . $row['title'];
            break;
        case "apps":
        case "location":
            if (preg_match("#^I\\S* \\w* a YouTube video#", $row['content'])) {
                $icon = IMAGE_ROOT . 'silk/film_add.png';
                $row['image'] = $icon;
                $match = preg_match("#I\\S* \\w* a YouTube video -- (.*?) (http.*)#", $row['originaltext'], $matches);
                $row['content'] = sprintf('<a href="%s">%s</a>', $matches[2], $matches[1]);
                $row['source'] = "YouTube";
            } elseif ($row['source'] == "LOVEFiLM.com Updates") {
                $match = preg_match("#(Played|Watched|Has been sent) (.*?): (http://LOVEFiLM.com/r/\\S*)#", $row['originaltext'], $matches);
                if ($match) {
                    $row['content'] = sprintf('%s <a href="%s">%s</a>', $matches[1], $matches[3], $matches[2]);
                }
                $icon = IMAGE_ROOT . 'other/favicon.png';
                $row['source'] = "LOVEFiLM";
            } elseif (strtolower($row['source']) == "foursquare" or strtolower($row['source']) == "foursquare-mayor") {
                if ($row['source'] == "Foursquare-Mayor") {
                    $icon = IMAGE_ROOT . 'foursquare%20icons/mayorCrown.png';
                } else {
                    $icon = IMAGE_ROOT . 'foursquare%20icons/foursquare%20256x256.png';
                }
                $row['content'] = preg_replace("/#\\w*/", "", $row['originaltext']);
                #preg_match("#(http://\S*)#", $row['content'], $matches);
                #echo $row['originaltext']."<br/>";
                $imat = preg_match("#I'm at (.*?) \\((.*?)\\)\\. (http://\\S*)#", $row['originaltext'], $matches);
                if ($imat) {
                    $row['content'] = sprintf('I\'m at <a href="%s">%s</a> (%s)', $matches[3], $matches[1], $matches[2]);
                } else {
                    $row['content'] = twitterFormat($row['content']);
                }
                if (isset($matches[1])) {
                    $row['url'] = $matches[1];
                }
                #$row['content'] = preg_replace("#http://\S*#", "", $row['content']);
                #$row['content'] = twitterFormat($row['content']);
                #$row['url'] = "http://www.champions-online.com/character_profiles/user_characters/Jascain";
            } elseif ($row['source'] == "Kindle") {
                $icon = IMAGE_ROOT . 'silk/book_open.png';
            } elseif ($row['source'] == "Miso") {
                $icon = IMAGE_ROOT . 'silk/television.png';
                preg_match("#(http://\\S*)#", $row['originaltext'], $matches);
                $row['url'] = $matches[1];
                $row['content'] = preg_replace("# http://\\S*#", "", $row['originaltext']);
            } elseif ($row['source'] == "Untappd") {
                $icon = IMAGE_ROOT . 'other/beer.png';
                $row['small_icon'] = IMAGE_ROOT . 'silk/drink.png';
                preg_match("#(http://\\S*)#", $row['originaltext'], $matches);
                $row['url'] = $matches[1];
                $row['content'] = preg_replace("# http://\\S*#", "", $row['originaltext']);
            }
            break;
        case "twitter":
            $icon = IMAGE_ROOT . 'twitter/Twitter-64.png';
            $row['small_icon'] = IMAGE_ROOT . 'twitter/rounded-plain-16x16/twitter-02.png';
            switch ($row['source']) {
                case "Steepster":
                    $icon = IMAGE_ROOT . 'silk/cup.png';
                    $row['content'] = preg_replace("/#\\w*/", "", $row['originaltext']);
                    preg_match("#(http://\\S*)#", $row['content'], $matches);
                    $row['url'] = $matches[1];
                    $row['content'] = preg_replace("#: http://\\S*#", "", $row['content']);
                    break;
                case "Goodreads":
                    $icon = IMAGE_ROOT . 'silk/book_open.png';
                    preg_match("#(http://\\S*)#", $row['originaltext'], $matches);
                    $row['url'] = $matches[1];
                    $row['content'] = preg_replace("# http://\\S*#", "", $row['originaltext']);
                    break;
                default:
                    $row['source'] = "Twitter";
            }
            break;
        case "flickr":
            $icon = IMAGE_ROOT . 'silk/picture.png';
            $row['content'] = sprintf('<a href="%s">%s</a>', $row['url'], $row['content']);
            break;
        case "code":
            $icon = IMAGE_ROOT . 'silk/application_osx_terminal.png';
            $row['content'] = $row['content'];
            break;
        case "oyster":
            $icon = IMAGE_ROOT . 'tfl.png';
            break;
        case "tumblr":
            $icon = IMAGE_ROOT . 'tumblr/tumblr_16.png';
            $row['small_image'] = IMAGE_ROOT . 'tumblr/tumblr_16.png';
            break;
        default:
            $icon = IMAGE_ROOT . 'silk/asterisk_orange.png';
    }
    if ($row['image']) {
        $icon = $row['image'];
        if (!isset($row['small_icon'])) {
            $row['small_icon'] = $icon;
        }
    }
    $row['icon'] = $icon;
    $row['nicetime'] = nicetime($row['epoch']);
    #$row['content'] = $row['type'].$row['content'];
    $row['id'] = md5($row['systemid']);
    return $row;
}
예제 #7
0
   case 2:
       // PC von User aus dem oberen Teil der Rangliste blockieren
       $victim = db_query('SELECT * FROM users WHERE rank<=50 ORDER BY RAND() LIMIT 1;');
       if (!$victim) {
           continue;
       }
       $victim = mysql_fetch_assoc($victim);
       if ((int) $victim['id'] == 0) {
           continue;
       }
       #echo '<br>id='.$victim['id'];
       $vpc = @mysql_fetch_assoc(db_query('SELECT id,ip,name FROM pcs WHERE owner=' . $victim['id'] . ' ORDER BY RAND() LIMIT 1;'));
       $blocked = time() + 6 * 60 * 60;
       db_query('UPDATE pcs SET blocked=\'' . mysql_escape_string($blocked) . '\' WHERE id=' . $vpc['id'] . ';');
       addsysmsg($victim['id'], 'Dein PC 10.47.' . $vpc['ip'] . ' (' . $vpc['name'] . ') wurde durch einen b&ouml;sartigen Wurm, der im Moment im Netz kursiert,
 bis ' . nicetime($blocked) . ' blockiert!');
       db_query('INSERT INTO logs SET type=\'worm_blockpc\', usr_id=\'' . mysql_escape_string($victim['id']) . '\', payload=\'blocked pc ' . $vpc['id'] . '\';');
       break;
   case 3:
       // PC von aktivem User aus dem Mittelfeld der Rangliste Credits schenken
       $ts = time() - 24 * 60 * 60;
       $victim = db_query('SELECT * FROM users WHERE (rank>50 AND login_time>' . mysql_escape_string($ts) . ') ORDER BY RAND() LIMIT 1;');
       echo mysql_error();
       if (!$victim) {
           continue;
       }
       $victim = mysql_fetch_assoc($victim);
       if ((int) $victim['id'] == 0) {
           continue;
       }
       #echo '<br>id='.$victim['id'];
function act_prepare($act_raw, $act_disp)
{
    global $options_act, $wpdb;
    $wp_url = get_bloginfo('wpurl');
    switch ($act_disp) {
        case 'admin':
        case 'csv':
            $act_date = nicetime($act_raw->act_date, true);
            $act_user = $act_raw->display_name;
            break;
        case 'rss':
            $act_date = gmdate('r', strtotime($act_raw->act_date));
            $act_user = '******' . $wp_url . '/' . $options_act['act_author_path'] . '/' . $act_raw->user_nicename . '" title="' . __('View Profile', 'wp-activity') . '">' . $act_raw->display_name . '</a>';
            break;
        case 'frontend':
        default:
            $act_date = nicetime($act_raw->act_date);
            $act_user = '******' . $wp_url . '/' . $options_act['act_author_path'] . '/' . $act_raw->user_nicename . '" title="' . __('View Profile', 'wp-activity') . '">' . $act_raw->display_name . '</a>';
            break;
    }
    switch ($act_raw->act_type) {
        case 'CONNECT':
            ($act_disp == 'admin' or $act_disp == 'csv') ? $act_params = $act_raw->act_params : ($act_params = '');
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('has logged in.', 'wp-activity'), 'params' => $act_params);
            break;
        case 'LOGIN_FAIL':
            $act_post_tab = explode("###", $act_raw->act_params);
            $act_done = array('class' => 'activity_warning', 'user' => $act_post_tab[0], 'text' => '', 'params' => $act_post_tab[1]);
            break;
        case 'ACCESS_DENIED':
            $act_post_tab = explode("###", $act_raw->act_params);
            $act_done = array('class' => 'activity_warning', 'user' => '', 'text' => '', 'params' => $act_post_tab[0]);
            break;
        case 'POST_ADD':
            if (is_numeric($act_raw->act_params)) {
                $act_post = get_post($act_raw->act_params);
                if ($act_raw->id != $act_post->post_author and !$strict_logs) {
                    //this is a check if post author has been changed in admin post edition.
                    $sql = "UPDATE " . $wpdb->prefix . "activity SET user_id = '" . $act_post->post_author . "' WHERE id = '" . $act_raw->id . "'";
                    $wpdb->query($sql);
                }
                if ($act_disp == 'csv') {
                    $act_params = $act_post->post_title;
                } else {
                    $act_params = '<a href="' . get_permalink($act_post->ID) . '">' . $act_post->post_title . '</a>';
                }
            } else {
                $act_params = $act_raw->act_params;
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('published', 'wp-activity'), 'params' => $act_params);
            break;
        case 'POST_EDIT':
            if (is_numeric($act_raw->act_params)) {
                $act_post = get_post($act_raw->act_params);
                if ($act_disp == 'csv') {
                    $act_params = $act_post->post_title;
                } else {
                    $act_params = '<a href="' . get_permalink($act_post->ID) . '">' . $act_post->post_title . '</a>';
                }
            } else {
                $act_params = $act_raw->act_params;
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('edited', 'wp-activity'), 'params' => $act_params);
            break;
        case 'POST_DEL':
            $act_post_tab = explode("###", $act_raw->act_params);
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('deleted', 'wp-activity'), 'params' => $act_post_tab[0]);
            break;
        case 'COMMENT_ADD':
            if (is_numeric($act_raw->act_params)) {
                $act_comment = get_comment($act_raw->act_params);
                $act_post = get_post($act_comment->comment_post_ID);
                if ($act_disp == 'csv') {
                    $act_params = $act_post->post_title;
                } else {
                    $act_params = '<a href="' . get_permalink($act_post->ID) . '#comment-' . $act_comment->comment_ID . '">' . $act_post->post_title . '</a>';
                }
            } else {
                $act_comment_tab = explode("###", $act_raw->act_params);
                if (isset($act_comment_tab[1])) {
                    $act_post = get_post($act_comment_tab[0]);
                    if ($act_disp == 'csv') {
                        $act_params = $act_post->post_title;
                    } else {
                        $act_params = '<a href="' . get_permalink($act_post->ID) . '">' . $act_post->post_title . '</a>';
                    }
                } else {
                    $act_params = $act_raw->act_params;
                }
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('commented', 'wp-activity'), 'params' => $act_params);
            break;
        case 'COMMENT_EDIT':
            if (is_numeric($act_raw->act_params)) {
                $act_comment = get_comment($act_raw->act_params);
                $act_post = get_post($act_comment->comment_post_ID);
                if ($act_disp == 'csv') {
                    $act_params = $act_post->post_title;
                } else {
                    $act_params = '<a href="' . get_permalink($act_post->ID) . '#comment-' . $act_comment->comment_ID . '">' . $act_post->post_title . '</a>';
                }
            } else {
                $act_comment_tab = explode("###", $act_raw->act_params);
                if (isset($act_comment_tab[1])) {
                    $act_post = get_post($act_comment_tab[0]);
                    if ($act_disp == 'csv') {
                        $act_params = $act_post->post_title;
                    } else {
                        $act_params = '<a href="' . get_permalink($act_post->ID) . '">' . $act_post->post_title . '</a>';
                    }
                } else {
                    $act_params = $act_raw->act_params;
                }
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('edited comment on', 'wp-activity'), 'params' => $act_params);
            break;
        case 'COMMENT_DEL':
            $act_post_tab = explode("###", $act_raw->act_params);
            if ($act_post = get_post($act_post_tab[2]) and $act_disp != 'csv') {
                $act_params = '<a href="' . get_permalink($act_post->ID) . '">' . $act_post->post_title . '</a>';
            } else {
                $act_params = $act_post->post_title;
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('deleted comment on', 'wp-activity'), 'params' => $act_params);
            break;
        case 'NEW_USER':
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('has registered.', 'wp-activity'), 'params' => $act_raw->act_params);
            break;
        case 'PROFILE_EDIT':
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('has updated his profile.', 'wp-activity'), 'params' => $act_raw->act_params);
            break;
        case 'LINK_ADD':
            $act_link = get_bookmark($act_raw->act_params);
            if ($act_disp == 'csv') {
                $act_params = $act_link->link_name;
            } else {
                $act_params = '<a href="' . $act_link->link_url . '" title="' . $act_link->link_description . '" target="' . $act_link->link_target . '">' . $act_link->link_name . '</a>.';
            }
            $act_done = array('class' => '', 'user' => $act_user, 'text' => __('has added a link to', 'wp-activity'), 'params' => $act_params);
            break;
        default:
            break;
    }
    $act_done['date'] = $act_date;
    $act_done['type'] = $act_raw->act_type;
    return $act_done;
}
예제 #9
0
파일: view.php 프로젝트: JakeCoxon/Pages
function page_lastupdate()
{
    global $page_array;
    return $page_array["lastupdate"] ? nicetime(time() - $page_array["lastupdate"]) . " ago" : "";
}
예제 #10
0
    case 'post':
        echo "<div class=\"row\">";
        if (isset($_GET['id'])) {
            $specific_posts = mysqli_query($db, "SELECT * FROM forum_posts WHERE id='" . $_GET['id'] . "' AND forum='" . $forum . "' ORDER BY `post_time` DESC");
            echo "<h3 class=\"col-xs-12\">Showing " . $_GET['title'] . " post</h3>";
        } elseif (isset($_GET['person'])) {
            $specific_posts = mysqli_query($db, "SELECT * FROM forum_posts WHERE sender='" . $_GET['person'] . "' AND forum='" . $forum . "' ORDER BY `post_time` DESC");
            echo "<h3 class=\"col-xs-12\">Showing posts submitted by " . $_GET['person'] . "</h3>";
        } elseif (isset($_GET['day'])) {
            $specific_posts = mysqli_query($db, "SELECT * FROM forum_posts WHERE post_time>='" . $_GET['day'] . "' AND post_time <'" . ($_GET['day'] + 86400) . "' AND forum='" . $forum . "' ORDER BY `post_time` DESC");
            echo "<h3 class=\"col-xs-12\">Showing all posts from " . date('j M Y', $_GET['day']) . "</h3>";
        }
        while ($specific_post = mysqli_fetch_array($specific_posts, MYSQL_ASSOC)) {
            $htmlDatetime = date('c', $specific_post['post_time']);
            $readableTime = date('D, d M Y H:i:s', $specific_post['post_time']);
            $niceTime = nicetime($specific_post['post_time']);
            $forumUserEmoji = html_entity_decode($specific_post['sender']);
            $forumUser = smilify($forumUserEmoji, $forumUserEmoji);
            $forumMessage = URL2link(smilify(nl2br(html_entity_decode($specific_post['message'])), $forumUserEmoji));
            ?>
            <div class="col-xs-12 forum-post">
                <div class="post-header"> <!--top bar with name, time and other details. bottom border-->
                    <strong class="post-header-name"><?php 
            echo $forumUser;
            ?>
</strong>
                    <small class="post-header-time">
                        <time datetime="<?php 
            echo $htmlDatetime;
            ?>
" title="<?php 
예제 #11
0
<?php

session_start();
require_once "../include.php";
if (!isIn()) {
    die;
}
global $mysqlusername, $mysqlpassword, $mysqldatabase, $mysqllocation;
$db = new mysqli($mysqllocation, $mysqlusername, $mysqlpassword, $mysqldatabase);
date_default_timezone_set('Asia/Singapore');
echo "<table style=\"width:100%\"><tr class=\"red\"><th colspan=\"2\" class=\"red\">BBT News Headlines</th></tr>";
$query = "SELECT newstext, time FROM news WHERE time <= " . time() . " ORDER BY time DESC LIMIT 30";
$result = $db->query($query) or die($db->error);
if ($result->num_rows <= 0) {
    echo "<tr><td colspan=\"2\" class=\"table-bordered\">There are no news reports at the moment.</td></tr>";
}
while ($row = $result->fetch_assoc()) {
    echo "<tr>";
    echo "<td class=\"table-bordered\">" . $row["newstext"] . "</td>";
    echo "<td class=\"table-bordered\" style=\"width:25%\">" . nicetime($row["time"]) . "</td>";
    echo "</tr>";
}
echo "</table>";
예제 #12
0
        ?>
</td>
		<td class="forum-caption" width="1%" style="white-space:nowrap"><?php 
        echo $locale['addondb403'];
        ?>
</td>
		<td class="forum-caption" width="1%" style="white-space:nowrap"><?php 
        echo $locale['addondb404'];
        ?>
</td>
	</tr>
<?php 
    }
    $ver = "v" . $data['version_h'] . "." . $data['version_l'] . ($data['version_s'] != "" ? " " . $data['version_s'] : "");
    $addon_author = $data['addon_author_name'] == "" ? $locale['addondb409'] : $data['addon_author_name'];
    $data['addon_date'] + 604800 > time() + $settings['timeoffset'] * 3600 ? $time = nicetime(showdate("%Y-%m-%d %H:%M:%S", $data['addon_date'])) : ($time = showdate("%d. %B", $data['addon_date']));
    if ($data['addon_date'] + $settings_global['set_new_time'] > time() + $settings['timeoffset'] * 3600) {
        $new = "<img src='" . ADDON_IMG . "new.png' border='0' alt='' />";
    } else {
        $new = "";
    }
    ?>
    <tr>
		<td class="tbl1" style="white-space:nowrap"><a href="view.php?addon_id=<?php 
    echo $data['addon_id'];
    ?>
"><?php 
    echo $new . trimlink($data['addon_name'], 30);
    ?>
</a></td>
		<td class="tbl2" width="1%" style="white-space:nowrap"><?php 
예제 #13
0
파일: main.php 프로젝트: Galaxy421/WOWMeter
</strong> users registered,<br>
		<strong><?php 
    echo $getwows_number_all;
    ?>
</strong> wows given,<br>
		<strong><?php 
    echo $getwows_number_today;
    ?>
</strong> given today.

		<p>Last wow was given to <?php 
    $hex = $lastwowuser['usrname_color'];
    echo "<span style='color:#{$hex}' class=\"table-color " . $lastwowuser["bg_color"] . " font-" . $lastwowuser["sig_font"] . "\"";
    $rsGeoData_lastusr = geoip_record_by_addr($gi, $lastwowuser['ip']);
    geoip_close($gi);
    echo "><img src='/images/flags/" . strtolower($rsGeoData_lastusr->country_code) . ".gif' title='" . htmlentities($rsGeoData_lastusr->country_name) . "' alt='" . htmlentities($rsGeoData_lastusr->country_name) . "'/> " . $lastwowuser['username'] . "</span><br><strong title='" . $getwows_last['wow_date'] . "'>" . nicetime($getwows_last['wow_date']) . "</strong>";
    if (!isset($wow_from)) {
        echo " from <strong>" . $city . $state . $country . " <img src='/images/flags/" . strtolower($rsGeoData->country_code) . ".gif' title='" . htmlentities($rsGeoData->country_name) . "' alt='" . htmlentities($rsGeoData->country_name) . "'/></strong>";
    } else {
        echo $wow_from;
    }
    ?>
.</p>

		<h3>Leaderboard</h3>
		<table style="min-width:220px;margin:0 auto;text-align:left">
		<?php 
    while ($leaderboard = mysqli_fetch_assoc($leaderboard_sql)) {
        $gi = geoip_open($_SERVER['DOCUMENT_ROOT'] . "/geoip/GeoLiteCity.dat", GEOIP_STANDARD);
        $rsGeoData = geoip_record_by_addr($gi, $leaderboard['ip']);
        $hex = $leaderboard['usrname_color'];
예제 #14
0
/**
 * This is registered at cb_head ANCHOR. This loads the photo tagging
 * plugin in clipbucket. You can use tagger_configurations filter to change
 * tagger configurations. Following is the list of configurations :
 * 
 *      |=  Show Tag labels =| BOOL
 *      showLabels => true
 * 
 *      |=  Provide an element ID and labels will loaded in them =| STRING
 *      labelWrapper => null
 * 
 *      |= Open labels links in new window =| BOOL
 *      labelLinksNew => false
 * 
 *      |= Make string like facebook: Tag1, Tag2 and Tag3 =| BOOL
 *      makeString => true
 * 
 *      |= We JS to create string. Set true, to create using CSS. Be warn CSS might not work in >IE9 =| BOOL
 *      makeStringCSS => false
 * 
 *      |= This wraps Remove Tag link in round brackets ( ) =| BOOL
 *      wrapDeleteLinks => true
 * 
 *      |= Show a little indicator arrow. Note: Arrow is created purely from CSS. Might not work in >IE9 =| BOOL
 *      use_arrows => true 
 *      
 *      |= To display Tag Photo elsewhere, provide an element ID  =| STRING
 *      buttonWrapper => null
 * 
 *      |= This will add a tag icon previous to Tag Photo text =| BOOL
 *      addIcon => true
 * 
 * @global object $db
 * @global object $cbphoto
 * @global array $photo
 * @global object $userquery
 * @return none 
 */
function load_tagging()
{
    global $db, $cbphoto, $photo, $userquery;
    if (USE_PHOTO_TAGGING != true) {
        return false;
    }
    if (empty($photo) || !$photo || !isset($photo['ci_id'])) {
        return false;
    }
    $options = $cbphoto->get_default_tagger_configs();
    $phrases = $options['phrases'];
    /* User does not need phrases in apply_filters() function */
    unset($options['phrases']);
    $options = apply_filters($options, 'tagger_configurations');
    /* Put back phrases in $options, over-wrtting JS Plugin Phrases */
    $options['phrases'] = $phrases;
    $options['allowTagging'] = $photo['allow_tagging'];
    $tags = $cbphoto->get_photo_tags($photo['photo_id']);
    $autoComplete = $options['autoComplete'];
    $uid = userid();
    if ($uid) {
        $friends = $userquery->get_contacts($uid, 0, 'yes');
    }
    if ($friends) {
        foreach ($friends as $contact) {
            $fa[$contact['contact_userid']] = $contact['username'];
            $typeahead[] = $contact['username'];
        }
    }
    if ($tags) {
        /* Tags exists */
        foreach ($tags as $tag) {
            $needs_update = false;
            /* Check if tag is active or not and if current user is not tagger or owner of photo or is guest, do not show tag */
            if (!$uid && $tag['ptag_active'] == 'no' || $tag['ptag_active'] == 'no' && $uid && $tag['ptag_by_userid'] != $uid && $tag['photo_owner_userid'] != $uid) {
                continue;
            }
            $ta = array();
            $ta['id'] = $tag['ptag_id'];
            $ta['key'] = $tag['ptag_key'];
            $ta['width'] = $tag['ptag_width'];
            $ta['height'] = $tag['ptag_height'];
            $ta['left'] = $tag['ptag_left'];
            $ta['top'] = $tag['ptag_top'];
            $ta['label'] = $tag['username'] = $tag['ptag_username'];
            $ta['added_by'] = $tag['ptag_by_username'];
            $ta['date_added'] = nicetime($tag['date_added'], true);
            if ($tag['ptag_active'] == 'no') {
                $ta['pending'] = true;
            }
            /* Photo owner and User which has tagged */
            if ($uid == $tag['photo_owner_userid'] || $uid == $tag['ptag_by_userid']) {
                $ta['canDelete'] = true;
            }
            /* 
            	If make sure tag is a user
            	See which person is online, tagger or tagged
            	If Tagger is online, give him option to delete
            
            	if Tagged is online, check if it's tagger's friend
            	if true, give option to delete
            */
            if ($tag['ptag_isuser'] == 1) {
                if ($uid == $tag['ptag_by_userid']) {
                    // Tagger is online
                    $ta['canDelete'] = true;
                    // Grant him access to delete
                    if (is_array($friends) && $fa[$tag['ptag_userid']]) {
                        $ta['link'] = $userquery->profile_link($tag['ptag_userid']);
                        // Person tagged is in his contacts lists and already been tagged, remove it from typahead array
                        unset($typeahead[end(array_keys($typeahead, $tag['ptag_username']))]);
                    }
                } else {
                    if ($uid == $tag['ptag_userid']) {
                        if (is_array($friends) && $fa[$tag['ptag_by_userid']]) {
                            $ta['canDelete'] = true;
                            $ta['link'] = $userquery->profile_link($tag['ptag_userid']);
                        }
                    }
                }
                /* This basically checks, if tagger and tagged and logged-in user are same 
                 * create the profile link for logged-in user. This will be achieved if user tags
                 * itself on a photo
                 */
                if ($tag['ptag_by_userid'] == $tag['ptag_userid'] && $tag['ptag_userid'] == $uid) {
                    $ta['link'] = $userquery->profile_link($tag['ptag_userid']);
                }
            }
            $defaultTags[] = $ta;
        }
        $options['defaultTags'] = $defaultTags;
    }
    if ($friends && $typeahead && $options['autoComplete'] == 1) {
        $options['autoCompleteOptions']['source'] = $typeahead;
    }
    assign('tagger_configs', json_encode($options));
    assign('selector_id', $cbphoto->get_selector_id());
    assign('photo', $photo);
    Template(STYLES_DIR . '/global/photo_tagger.html', false);
}
예제 #15
0
            case 'plgaup_getcouponcode_vm':
            case 'plgaup_alphagetcouponcode_vm':
            case 'sysplgaup_buypointswithpaypal':
                echo '';
                break;
            default:
                echo str_replace("\\", "", $item->datareference);
        }
        ?>
				</div>
				<div class="small" style="margin-left:<?php 
        echo $margin;
        ?>
px;margin-top:2px;">
				<?php 
        echo nicetime($item->insert_date);
        ?>
	
				</div>
			<div style="margin-left:<?php 
        echo $margin;
        ?>
px;margin-top:3px;">
				<span class="small">
				<?php 
        if ($user->id || !$user->id && $com_params->get('allowGuestUserViewProfil', 1)) {
            echo '<a href="' . $profil . '">' . $usrname . '</a>';
        } else {
            echo $usrname;
        }
        ?>
예제 #16
0
 /**
  * Function used to get user feed
  */
 function getUserFeeds($user)
 {
     global $cbphoto, $userquery, $cbvid, $cbgroup, $cbcollection;
     $allowed_feeds = USER_ACTIVITY_FEEDS_LIMIT;
     $uid = $user['userid'];
     $feeds = $this->getUserFeedsFiles($uid);
     if (!$feeds) {
         return false;
     }
     $newFeeds = array();
     $coutn = 0;
     foreach ($feeds as $feed) {
         $count++;
         if ($count > $allowed_feeds) {
             break;
         }
         $feedArray = json_decode($feed['content'], true);
         if ($feed && count($feedArray > 0)) {
             $remove_feed = false;
             $farr = $feedArray;
             $action = $farr['action'];
             $object = $farr['object'];
             $object_id = $farr['object_id'];
             $farr['user'] = $user;
             $farr['file'] = getName($feed['file']);
             $farr['datetime'] = nicetime($farr['time'], true);
             $userlink = '<a href="' . $userquery->profile_link($user) . '">' . $user['username'] . '</a>';
             //Creating Links
             switch ($action) {
                 case "upload_photo":
                     $photo = $cbphoto->get_photo($object_id);
                     //If photo does not exists, simply remove the feed
                     if (!$photo) {
                         $this->deleteFeed($uid, $feed['file']);
                         $remove_feed = true;
                     } else {
                         $objectArr['details'] = $photo;
                         $objectArr['size'] = 't';
                         $objectArr['output'] = 'non_html';
                         $objectArr['alt'] = $photo['photo_title'];
                         $farr['thumb'] = $cbphoto->getFileSmarty($objectArr);
                         $farr['link'] = $cbphoto->photo_links($photo, 'view_item');
                         //Content Title
                         $farr['title'] = $photo['photo_title'];
                         $farr['action_title'] = sprintf(lang('user_has_uploaded_new_photo'), $userlink);
                         $farr['links'][] = array('link' => $cbphoto->photo_links($photo, 'view_item'), 'text' => lang('view_photo'));
                         $farr['icon'] = 'images.png';
                     }
                     break;
                 case "upload_video":
                 case "add_favorite":
                     $video = $cbvid->get_video($object_id);
                     //If photo does not exists, simply remove the feed
                     if (!$video) {
                         $this->deleteFeed($uid, $feed['file']);
                         $remove_feed = true;
                     } elseif (!video_playable($video)) {
                         $remove_feed = true;
                     } else {
                         //Content Title
                         $farr['title'] = $video['title'];
                         if ($action == 'upload_video') {
                             $farr['action_title'] = sprintf(lang('user_has_uploaded_new_video'), $userlink);
                         }
                         if ($action == 'add_favorite') {
                             $farr['action_title'] = sprintf(lang('user_has_favorited_video'), $userlink);
                         }
                         $farr['link'] = videoLink($video);
                         $farr['object_content'] = $video['description'];
                         $farr['thumb'] = get_thumb($video);
                         $farr['links'][] = array('link' => videoLink($video), 'text' => lang('watch_video'));
                         $farr['icon'] = 'video.png';
                         if ($action == 'add_favorite') {
                             $farr['icon'] = 'heart.png';
                         }
                     }
                     break;
                 case "create_group":
                 case "join_group":
                     $group = $cbgroup->get_group($object_id);
                     //If photo does not exists, simply remove the feed
                     if (!$group) {
                         $this->deleteFeed($uid, $feed['file']);
                         $remove_feed = true;
                     } elseif (!$cbgroup->is_viewable($group)) {
                         $remove_feed = true;
                     } else {
                         //Content Title
                         $farr['title'] = $group['group_name'];
                         if ($action == 'create_group') {
                             $farr['action_title'] = sprintf(lang('user_has_created_new_group'), $userlink);
                         }
                         if ($action == 'join_group') {
                             $farr['action_title'] = sprintf(lang('user_has_joined_group'), $userlink);
                         }
                         $farr['link'] = group_link(array('details' => $group));
                         $farr['object_content'] = $group['group_description'] . "<br>" . lang('total_members') . " : " . $group['total_members'] . "<br>" . lang('total_videos') . " : " . $group['total_videos'] . "<br>" . lang('total_topics') . " : " . $group['total_topics'] . "<br>";
                         $farr['thumb'] = $cbgroup->get_group_thumb($group);
                         $farr['icon'] = 'group.png';
                         $joinlink = $cbgroup->group_opt_link($group, 'join');
                         if ($joinlink) {
                             if (SEO == "yes") {
                                 $joinlink = group_link(array('details' => $group)) . '?join=yes"';
                             } else {
                                 $joinlink = group_link(array('details' => $group)) . '&join=yes"';
                             }
                             $farr['links'][] = array('link' => $joinlink, 'text' => lang('join'));
                         }
                     }
                     break;
                 case "signup":
                     $farr['action_title'] = sprintf(lang("user_joined_us"), $userlink, TITLE, $userlink);
                     $farr['icon'] = 'user.png';
                     break;
                 case "add_friend":
                     $friend = $userquery->get_user_details($object_id);
                     if (!$friend) {
                         $this->deleteFeed($uid, $feed['file']);
                         $remove_feed = true;
                     } else {
                         $friendlink = '<a href="' . $userquery->profile_link($friend) . '">' . $friend['username'] . '</a>';
                         $farr['action_title'] = sprintf(lang("user_is_now_friend_with_other"), $userlink, $friendlink);
                         $farr['icon'] = 'user_add.png';
                     }
                     break;
                 case "add_collection":
                     $collection = $cbcollection->get_collection($object_id);
                     if (!$collection) {
                         $this->deleteFeed($uid, $feed['file']);
                         $remove_feed = true;
                     } else {
                         $farr['action_title'] = sprintf(lang('user_has_created_new_collection'), $userlink);
                         $farr['thumb'] = $cbcollection->get_thumb($collection, 'small');
                         $farr['title'] = $collection['collection_name'];
                         $collection_link = $cbcollection->collection_links($collection, 'view');
                         $farr['link'] = $collection_link;
                         $farr['object_content'] = $collection['collection_description'] . '<br>' . $collection['total_objects'] . " " . $collection['type'];
                         $farr['icon'] = 'photos.png';
                         $farr['links'][] = array('link' => $collection_link, 'text' => lang('view_collection'));
                     }
             }
             if (!$remove_feed) {
                 $newFeeds[$feedArray['time']] = $farr;
             }
         }
     }
     return $newFeeds;
 }
예제 #17
0
</span>
<?php 
if (@$this->userrankinfo) {
    if ($this->userrankinfo->image) {
        $pathimage = JPATH_COMPONENT . DS . 'assets/images/awards/large/' . $this->userrankinfo->image;
        $image = new JImage($pathimage);
        $userrankimg = $image->createThumbs(array('16x16'), JImage::CROP_RESIZE, JPATH_COMPONENT . DS . 'assets' . DS . 'images' . DS . 'awards' . DS . 'large' . DS . 'thumbs');
        $userrankimg = myImage::getLivePathImage($userrankimg);
        echo '<img src="' . $userrankimg . '" alt="" />';
    }
    echo " (" . $this->userrankinfo->rank . ")";
}
echo "<br />";
echo "<b>" . JText::_('AUP_LASTUPDATE') . "</b> : " . JHTML::_('date', $this->lastupdate, JText::_('DATE_FORMAT_LC2')) . "<br />";
echo "<b>" . JText::_('AUP_MEMBER_SINCE') . "</b> : " . JHTML::_('date', $this->userinfo->registerDate, JText::_('DATE_FORMAT_LC3')) . "<br />";
echo "<b>" . JText::_('AUP_LAST_ONLINE') . "</b> : " . nicetime($this->userinfo->lastvisitDate) . "<br />";
if ($this->referraluser != '') {
    if ($this->params->get('show_links_to_users', 1)) {
        $_user_info = AlphaUserPointsHelper::getUserInfo($this->referraluser);
        $linktoprofilreferral = getProfileLink($_profilelink, $_user_info);
        $linktoprofilreferral = "<a href=\"" . JRoute::_($linktoprofilreferral) . "\">" . $this->referralname . "</a>";
    } else {
        $linktoprofilreferral = $this->referralname;
    }
    echo "<b>" . JText::_('AUP_MYREFRERRALUSER') . "</b> : ";
    echo $this->referraluser . " (" . $linktoprofilreferral . ")";
    echo "<br />";
}
if ($this->params->get('show_links_to_users', 1)) {
    echo "<b>" . JText::_('AUP_PROFILE_VIEWS') . "</b> : <span class=\"badge badge-info\">" . $profilviews . "</span><br />";
}
예제 #18
0
파일: main.php 프로젝트: yukisky/clipbucket
     } else {
         echo json_encode(array('msg' => array(lang('Playlist has been removed'))));
     }
     break;
 case "add_playlist_item":
     $type = post('v');
     $pid = mysql_clean(post('pid'));
     $id = mysql_clean(post('oid'));
     // $note = mysql_clean(post('note'));
     switch ($type) {
         case 'v':
         default:
             $item_id = $cbvid->action->add_playlist_item($pid, $id);
             if (!error()) {
                 updateObjectStats('plist', 'video', $id);
                 echo json_encode(array('status' => 'ok', 'msg' => msg(), 'item_id' => $item_id, 'updated' => nicetime(now())));
             } else {
                 echo json_encode(array('err' => error()));
             }
     }
     break;
 case "update_playlist_order":
     $pid = mysql_clean(post('playlist_id'));
     $items = post('playlist_item');
     $items = array_map('mysql_clean', $items);
     $cbvid->action->update_playlist_order($pid, $items);
     if (error()) {
         echo json_encode(array('err' => error()));
     } else {
         echo json_encode(array('success' => 'yes'));
     }
예제 #19
0
    $event = mysqli_real_escape_string($db, $_POST['eventname']);
    // intialize to be blank, not used
    $email = NULL;
    $confirmed = 1;
    $auth = '';
    $insert_post = mysqli_query($db, "INSERT INTO photo_comments (photoid, event, sender, email, post_time, message, ipaddress, confirmed, auth) VALUES('{$photoid}', '{$event}', '{$sender}', '{$email}', '" . time() . "', '{$message}', '{$user_ip}', '{$confirmed}', '{$auth}')");
    if (!$insert_post) {
        die(json_encode(array('error' => mysqli_error($db))));
    } else {
        $special = $userPosition == 'Webmaster' ? $client_ip : '';
        die(json_encode(array('newComment' => array('sender' => smilify(html_entity_decode($_POST['sender']), $_POST['sender']), 'message' => URL2link(smilify(nl2br(html_entity_decode($_POST['message'])), $_POST['sender'])), 'htmlDatetime' => date('c', time()), 'readableTime' => date('D, d M Y H:i:s', time()), 'niceTime' => nicetime(time()), 'special' => $special))));
    }
} else {
    if ($_POST['action'] == 'getComments') {
        $photoid = mysqli_real_escape_string($db, $_POST['photoid']);
        $event = mysqli_real_escape_string($db, $_POST['eventname']);
        $photo_comments = mysqli_query($db, "SELECT * FROM photo_comments WHERE photoid='{$photoid}' AND event='{$event}' ");
        if (mysqli_num_rows($photo_comments) == 0) {
            die(json_encode(array('empty' => 'no comments')));
        } else {
            $comments = array();
            while ($comment = mysqli_fetch_array($photo_comments, MYSQL_ASSOC)) {
                $datetime = date('G:i j/M/y', $comment['post_time']);
                $nicetime = nicetime($comment['post_time']);
                $special = $userPosition == 'Webmaster' ? decode_ip($comment['ipaddress']) : '';
                $comments[] = array('sender' => smilify(html_entity_decode($comment['sender']), $comment['sender']), 'message' => URL2link(smilify(nl2br(html_entity_decode($comment['message'])), $comment['sender'])), 'htmlDatetime' => date('c', $comment['post_time']), 'readableTime' => date('D, d M Y H:i:s', $comment['post_time']), 'niceTime' => nicetime($comment['post_time']), 'special' => $special);
            }
            die(json_encode(array('comments' => $comments)));
        }
    }
}
예제 #20
0



foreach($creds as $status ) {
	$profileimg= $status->user->profile_image_url;
	$screenname= $status->user->screen_name;
	
	$profileurl= "http://twitter.com/$screenname";
	echo "<div id=\"container\"><div id=\"row\"><div id='left'><br/><a href=\"$profileurl\"><img src=\"$profileimg\" alt=\"$screenname\" border=\"0\" /></a></div>";
	echo "<div id='middle'>";
echo "<ul>";

	$statusid=$status->id;
	$time=$status->created_at;
	$ago= nicetime($time);
	$via=$status->source;
	$privatestatus= $status->user->protected;
	$tweets=$status->text;
	$url = "http://twitter.com/$screenname/status/$statusid";
	//echo "$privatestatus";
	echo "<li> ";
	echo "<div class=\"font\">";
	$tweetsurl="http://likethis.in/twitter/status.php?id=$statusid";
	$tweetscomplete = $autolinker->autolink($tweets);
	
	echo "<a href=\"$profileurl\"><b>$screenname</b></a>";
	echo " $tweetscomplete   ";
	
	
	echo "<div class=\"infobox\"><div class=\"fontsmall\"><a href=\"$url\">$ago</a> via $via</div></div>";
예제 #21
0
        ?>
</td>
				            <td><?php 
        echo $row['level_name'];
        ?>
</td>
				            <td><?php 
        if ($row['admin_status'] == 1) {
            echo "Active";
        } else {
            echo "Inactive";
        }
        ?>
</td>
				            <td><?php 
        echo nicetime($row['admin_last_login']);
        ?>
</td>
				           
				             	             
				           <td><?php 
        if ($row['level'] >= 2) {
            ?>
<a href="<?php 
            echo base_url();
            ?>
user/edit_user/<?php 
            echo $row['admin_id'];
            ?>
"><img src="<?php 
            echo base_url();
예제 #22
0
/**
 * Smarty plugin
 *
 * Type:     modifier<br>
 * Name:     nicetime<br>
 * Date:     Mar 27, 2009
 * Purpose:  pass through nicetime() function
 * Input:<br>
 *         - contents = contents to replace
 * Example:  {$date|nicetime}
 * @version  1.0
 * @author   James Baicoianu
 * @param string
 * @return string
 */
function smarty_modifier_nicetime($time)
{
    return nicetime($time);
}
예제 #23
0
        ?>
" alt="<?php 
        isset($feed->feed_image_title) ? $feed->feed_image_title : '';
        ?>
">
                                    </a>
                                </div> 
                                <div>
                                    <div class="author_name">
                                        <a href="#"><?php 
        echo $feed_title;
        ?>
</a>
                                    </div>
                                    <div class="date"><?php 
        echo nicetime($date);
        ?>
</div>
                                </div>
                            </div>
                            <div class="main_content_share_button wd20_wd" style="">
                                <div id="slideToggleParent_<?php 
        echo $feed->id;
        ?>
" class="main_content_share" style="display: none">
                                    <span class="st_facebook_large" displayText="Facebook"></span>
                                    <span class="st_twitter_large" displayText="Tweet"></span>
                                    <span class="st_email_large" displayText="Email"></span>
                                    <span class="st_plusone_large" displayText="Google +1"></span>
                                </div>
                                <div id="slideToggle_<?php 
예제 #24
0
파일: news.php 프로젝트: robdmat/sport.net
 /**
  */
 public function next()
 {
     $type = 'news';
     $pagination = $this->input->post('page', TRUE);
     $ulclass = $this->input->post('ulclass', TRUE);
     if (isset($ulclass) && $ulclass == 'true') {
         $sponserList = 'style="display:none"';
         $description = 'style="display:block"';
     } else {
         $sponserList = 'style="display:block"';
         $description = 'style="display:none"';
     }
     if (isset($pagination) && $pagination != '') {
         $next_set = $pagination;
     } else {
         $next_set = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
     }
     $count = $this->feedModel->getAllDataCount($type);
     $config = array();
     $config["base_url"] = base_url() . "home/next";
     $config["total_rows"] = $count;
     $config["per_page"] = 22;
     $config['use_page_numbers'] = true;
     $config["uri_segment"] = 3;
     $config['num_links'] = '10';
     $config['last_link'] = '';
     $this->pagination->initialize($config);
     $page = $next_set;
     $limit = $config["per_page"];
     $offset = $limit * ($page - 1);
     $feeds_list = $this->getAllData($limit, $offset, $type);
     $pagination_links = $this->pagination->create_links();
     $postsdata = '';
     $countForAd = 1;
     if (!empty($feeds_list)) {
         $default_image = getDefaultImage();
         $default_url = 'javascript:void(0)';
         foreach ($feeds_list as $feed) {
             $feed_url = isset($feed->feed_url) ? $feed->feed_url : $default_url;
             $feed_title = isset($feed->feed_title) ? $feed->feed_title : 'title';
             //                Get the title
             $feed_image_title = isset($feed->feed_user_title) ? $feed->feed_user_title : 'Admin';
             $feed_title_truncated = substr($feed_image_title, 0, 40);
             $alt_image = isset($feed->feed_image_title) ? $feed->feed_image_title : '';
             // Feed content to remove the html tags and get the first image
             $html = $feed->feed_content;
             preg_match_all('/<img[^>]+>/i', $html, $result);
             $feed_image = $result;
             $date = isset($feed->feed_date) ? $feed->feed_date : date('Y-m-d');
             $feed_image = isset($feed_image[0][0]) ? $feed_image[0][0] : $default_image;
             //                $avater = isset($feed->feed_image_urls) ? $feed->feed_image_urls : site_url('assets/img/avatar.jpg');
             $avatar = feedIconByUrl($feed->feed_admin_url);
             if (!empty($avatar)) {
                 $favicon = site_url() . 'uploads/feed/' . $avatar;
             } else {
                 $favicon = site_url('assets/img/avatar.jpg');
             }
             $postsdata .= '<li>';
             $postsdata .= '<div class="item video clear_fix">';
             $postsdata .= '<div class="img fl_left">';
             $postsdata .= '<a href="' . site_url() . 'feeds/preview/' . $feed->feed_content_hash . '">';
             if (file_exists($feed_image)) {
                 $feed_image;
             } else {
                 $default_image;
             }
             $postsdata .= '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="info">';
             $postsdata .= '<div class="name">';
             $postsdata .= '<a href="' . site_url() . 'feeds/preview/' . $feed->feed_content_hash . '">' . $feed->feed_title . '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div class = "text">' . strip_tags(substr($html, 0, 800)) . '</div>';
             $postsdata .= '<div class="bottom table clear_fix">';
             $postsdata .= ' <div class="author clear_fix">';
             $postsdata .= '<div class="author_img fl_left">';
             $postsdata .= '<a href="#">';
             $postsdata .= '<img alt="Ashley Clements" src="' . site_url() . '/assets/img/avatar.jpg' . '">';
             $postsdata .= '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div>';
             $postsdata .= '<div class="author_name">';
             $postsdata .= '<a href="#">' . $feed_title . '</a>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="date">' . nicetime($date) . '</div>';
             $postsdata .= '</div>';
             $postsdata .= '</div>';
             $postsdata .= '<div class="icon">';
             $postsdata .= '<a href="#"></a>';
             $postsdata .= '</div>';
             $postsdata .= '</div>';
             $postsdata .= '</div>';
             $postsdata .= '</div>';
             $postsdata .= '</li>';
             $countForAd++;
         }
         echo $postsdata;
         return;
     } else {
         return;
     }
 }
예제 #25
0
 /**
  * This function loads photo tagger and it's default tags
  * @global OBJECT $userquery
  * @return ARRAY 
  */
 function load_tagging()
 {
     $args = func_get_args();
     $photo = $args[0];
     // If photo tagging is disabled by admin return false
     if (USE_PHOTO_TAGGING != true) {
         return false;
     } else {
         if (!$photo || empty($photo)) {
             return false;
         } else {
             global $userquery;
             if (!empty($args[1]) || $args[1] != '' || is_null($args[1])) {
                 $options = cb_parse_args_string($args[1]);
             }
             if (is_array($options) && !empty($options)) {
                 $options = array_merge($this->load_default_tagger_configs(), $options);
             } else {
                 $options = $this->get_default_tagger_configs();
             }
             $options['allowTagging'] = $photo['allow_tagging'];
             $tags = $this->get_photo_tags($photo['photo_id']);
             $uid = userid();
             /* Get user contacts list. This will help us in making suggestions
                   while tagging. Showing profile link on tag
                */
             if ($uid) {
                 $friends = $userquery->get_contacts($uid, 0, 'yes');
             }
             if ($friends) {
                 foreach ($friends as $contact) {
                     $fa[$contact['contact_userid']] = $contact['username'];
                     $typeahead[] = $contact['username'];
                 }
             }
             if ($tags) {
                 /* Tags exists */
                 foreach ($tags as $tag) {
                     $needs_update = false;
                     /* Check if tag is active or not and if current user is not tagger or owner of photo or is guest, do not show tag */
                     if (!$uid && $tag['ptag_active'] == 'no' || $tag['ptag_active'] == 'no' && $uid && $tag['ptag_by_userid'] != $uid && $tag['photo_owner_userid'] != $uid) {
                         continue;
                     }
                     $ta = array();
                     $ta['id'] = $tag['ptag_id'];
                     $ta['key'] = $tag['ptag_key'];
                     $ta['width'] = $tag['ptag_width'];
                     $ta['height'] = $tag['ptag_height'];
                     $ta['left'] = $tag['ptag_left'];
                     $ta['top'] = $tag['ptag_top'];
                     $ta['label'] = $tag['username'] = $tag['ptag_username'];
                     $ta['added_by'] = $tag['ptag_by_username'];
                     $ta['date_added'] = nicetime($tag['date_added'], true);
                     if ($tag['ptag_active'] == 'no') {
                         $ta['pending'] = true;
                     }
                     /* Photo owner and User which has tagged */
                     if ($uid == $tag['photo_owner_userid'] || $uid == $tag['ptag_by_userid']) {
                         $ta['canDelete'] = true;
                     }
                     /* 
                         If make sure tag is a user
                         See which person is online, tagger or tagged
                         If Tagger is online, give him option to delete
                     
                         if Tagged is online, check if it's tagger's friend
                         if true, give option to delete
                     */
                     if ($tag['ptag_isuser'] == 1) {
                         if ($uid == $tag['ptag_by_userid']) {
                             // Tagger is online
                             $ta['canDelete'] = true;
                             // Grant him access to delete
                             if (is_array($friends) && $fa[$tag['ptag_userid']]) {
                                 $ta['link'] = $userquery->profile_link($tag['ptag_userid']);
                                 // Person tagged is in his contacts lists and already been tagged, remove it from typahead array
                                 unset($typeahead[end(array_keys($typeahead, $tag['ptag_username']))]);
                             }
                         } else {
                             if ($uid == $tag['ptag_userid']) {
                                 if (is_array($friends) && $fa[$tag['ptag_by_userid']]) {
                                     $ta['canDelete'] = true;
                                 }
                                 $ta['link'] = $userquery->profile_link($tag['ptag_userid']);
                             }
                         }
                     }
                     $defaultTags[] = $ta;
                 }
                 $options['defaultTags'] = $defaultTags;
             }
             if ($friends && $typeahead && $options['autoComplete'] == 1) {
                 $options['autoCompleteOptions']['source'] = $typeahead;
             }
             assign('tagger_configs', json_encode($options));
             assign('selector_id', $this->get_selector_id());
             assign('photo', $photo);
             Template(STYLES_DIR . '/global/photo_tagger.html', false);
         }
     }
 }
예제 #26
0
        echo '<table class="sofT" cellspacing="0"><tr><td class="helpHed">Name</td><td class="helpHed">' . $GB_Pet['petName'] . '</td></tr>';
        echo '<tr><td>Pet last Fed Time</td><td>' . nicetime($GB_Pet['lastFedTime'] / 1000) . '</td></tr>';
        if ($GB_Pet['isRunAway'] == 1) {
            $isRunAwayText = "<font color='red'>Pet is run away. Goto farmville to get it back!</font>";
        } else {
            $isRunAwayText = " ";
        }
        echo '<tr><td>Is Runaway?</td><td>' . $isRunAwayText . '</td></tr>';
        if ($GB_Pet['lastRunaway'] > 0) {
            $LastRunaway = @date("Y-M-d H:i:s", $GB_Pet['lastRunaway'] / 1000);
        } else {
            $LastRunaway = "";
        }
        echo '<tr><td>Last Run away</td><td>' . $LastRunaway . '</td></tr>';
        echo '<tr><td>Kibble Fed Count</td><td>' . $GB_Pet['kibbleFedCount'] . '</td></tr>';
        echo '<tr><td>Born</td><td>' . nicetime($GB_Pet['plantTime'] / 1000) . '</td></tr>';
        echo '<tr><td>Pet Level</td><td>' . $GB_Pet['petLevel'] . '</td></tr>';
        echo '<tr><td>Name</td><td>' . $GB_Pet['itemName'] . '</td></tr>';
        echo '<tr><td>Real Name</td><td>' . $GB_units[$GB_Pet['itemName']]['realname'] . '</td></tr>';
        echo '<tr><td>ID</td><td>' . $GB_Pet['id'] . '</td></tr>';
        echo '<tr><td>Next feed</td><td>' . @date("Y-M-d H:i:s", $GB_Pet['lastFedTime'] / 1000 + 86401) . '</td></tr>';
        echo '</table><br>';
    }
    echo '<br>';
}
//   ***************************************************************************
//   ***   Menu Screen
$GB_current_url = "place_all";
//   ***
//   ***************************************************************************
if ($GB_url == $GB_current_url) {
    function content_56afd7a7b66b49_76302993($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include '/var/www/html/includes/smartyv3/plugins/modifier.date_format.php';
        }
        if (!is_callable('smarty_modifier_truncate')) {
            include '/var/www/html/includes/smartyv3/plugins/modifier.truncate.php';
        }
        ?>
<div class="row message">
    <div class="row accountprofile">
    <div class="col-md-10">
        <div class="media">
            <a class="pull-left" href="#">
                <img class="media-object imgobject" src="<?php 
        echo $_smarty_tpl->tpl_vars['userquery']->value->getUserThumb($_smarty_tpl->tpl_vars['user']->value);
        ?>
" width="142" alt="...">
            </a>
            <div class="media-body">
                <div class="row">
                    <div class="col-md-6 procolor">
                        <h4 class="media-heading headcolor"><?php 
        echo $_smarty_tpl->tpl_vars['user']->value['username'];
        ?>
  (<?php 
        if (isset($_smarty_tpl->tpl_vars['category'])) {
            $_smarty_tpl->tpl_vars['category'] = clone $_smarty_tpl->tpl_vars['category'];
            $_smarty_tpl->tpl_vars['category']->value = $_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']);
            $_smarty_tpl->tpl_vars['category']->nocache = null;
            $_smarty_tpl->tpl_vars['category']->scope = 0;
        } else {
            $_smarty_tpl->tpl_vars['category'] = new Smarty_variable($_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']), null, 0);
        }
        ?>
                            <?php 
        echo $_smarty_tpl->tpl_vars['category']->value['category_name'];
        ?>
)</h4>
                        <b><?php 
        echo smarty_lang(array('code' => 'Since:'), $_smarty_tpl);
        ?>
</b> (<?php 
        echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['user']->value['doj']);
        ?>
)
                               <b><?php 
        echo smarty_lang(array('code' => 'last Login:'******'user']->value['last_logged']);
        ?>
)

                    </div>
                    <!--<div class="col-md-4 procolor">-->
                        <!--(<?php 
        if (isset($_smarty_tpl->tpl_vars['category'])) {
            $_smarty_tpl->tpl_vars['category'] = clone $_smarty_tpl->tpl_vars['category'];
            $_smarty_tpl->tpl_vars['category']->value = $_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']);
            $_smarty_tpl->tpl_vars['category']->nocache = null;
            $_smarty_tpl->tpl_vars['category']->scope = 0;
        } else {
            $_smarty_tpl->tpl_vars['category'] = new Smarty_variable($_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']), null, 0);
        }
        ?>
-->
                        <!--<?php 
        echo $_smarty_tpl->tpl_vars['category']->value['category_name'];
        ?>
)<br>-->
                        <!--<?php 
        echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['user']->value['doj']);
        ?>
<br>-->
                        <!--<?php 
        echo nicetime($_smarty_tpl->tpl_vars['user']->value['last_logged']);
        ?>
-->
                    <!--</div>-->
                </div>
            </div>
        </div>
        </div>

        <!--<div class="row">-->
            <!--<div class="col-md-6">-->

                <!--<?php 
        echo smarty_lang(array('code' => 'username:'******'code' => 'joined:'), $_smarty_tpl);
        ?>
<br>-->
                <!--<?php 
        echo smarty_lang(array('code' => 'last logged in:'), $_smarty_tpl);
        ?>
<br>-->
                <!--<?php 
        echo smarty_lang(array('code' => 'category:'), $_smarty_tpl);
        ?>
<br>-->
            <!--</div>-->
            <!--<div class="col-md-6">-->
                <!--<?php 
        echo $_smarty_tpl->tpl_vars['user']->value['username'];
        ?>
<br>-->
                <!--<?php 
        echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['user']->value['doj']);
        ?>
<br>-->
                <!--<?php 
        echo nicetime($_smarty_tpl->tpl_vars['user']->value['last_logged']);
        ?>
<br>-->
                <!--<?php 
        if (isset($_smarty_tpl->tpl_vars['category'])) {
            $_smarty_tpl->tpl_vars['category'] = clone $_smarty_tpl->tpl_vars['category'];
            $_smarty_tpl->tpl_vars['category']->value = $_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']);
            $_smarty_tpl->tpl_vars['category']->nocache = null;
            $_smarty_tpl->tpl_vars['category']->scope = 0;
        } else {
            $_smarty_tpl->tpl_vars['category'] = new Smarty_variable($_smarty_tpl->tpl_vars['userquery']->value->get_category($_smarty_tpl->tpl_vars['user']->value['category']), null, 0);
        }
        ?>
-->
                <!--<?php 
        echo $_smarty_tpl->tpl_vars['category']->value['category_name'];
        ?>
-->
            <!--</div>-->
        <!--</div>-->


        </div>
</div>
        <hr class="newhr1">
        <div class="mvideo accountprofile">
            <span class="lead">
                <?php 
        echo smarty_lang(array('code' => 'Latest Videos'), $_smarty_tpl);
        ?>

            </span>
<table class="table table-bordered table-striped manageUsersTable">
    <tr>
        <td><i class="icon-facetime-video"></i> Videos Details</td>
        <td>Option</td>
    </tr>
    <?php 
        if ($_smarty_tpl->tpl_vars['videos']->value) {
            ?>
    
    <?php 
            $_smarty_tpl->tpl_vars['video'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['video']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['videos']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['video']->key => $_smarty_tpl->tpl_vars['video']->value) {
                $_smarty_tpl->tpl_vars['video']->_loop = true;
                ?>

    <tr>
        <td>
            <div class="row">
                <div class="col-md-10">
                    <div class="row">
                        <div class="col-md-3">
                          <a href="<?php 
                echo $_smarty_tpl->tpl_vars['baseurl']->value;
                ?>
/edit_video.php?vid=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videoid'];
                ?>
">
                            <img src="<?php 
                echo getSmartyThumb(array('vdetails' => $_smarty_tpl->tpl_vars['video']->value), $_smarty_tpl);
                ?>
" width="130" height="80" id="thumbs_<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videoid'];
                ?>
" class="vthumb" title=""/>
                            <span class="duration">(<?php 
                if ($_smarty_tpl->tpl_vars['video']->value['duration'] > 1) {
                    echo SetTime($_smarty_tpl->tpl_vars['video']->value['duration']);
                } else {
                    ?>
00:00<?php 
                }
                ?>
)</span>
                           </a>     
                        </div>
                        <div class="col-md-9">
                            <a href="edit_video.php?vid=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videoid'];
                ?>
">
                                <?php 
                echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['video']->value['title'], 80);
                ?>
 </a><br>
                         <span class="maccountlabels"> <strong><?php 
                echo niceTime($_smarty_tpl->tpl_vars['video']->value['date_added']);
                ?>
</strong>
                            <?php 
                echo smarty_lang(array('code' => 'views'), $_smarty_tpl);
                ?>
 : <strong><?php 
                echo number_format($_smarty_tpl->tpl_vars['video']->value['views']);
                ?>
</strong></span>
                            <div class="labels">
                                <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['featured'] == 'yes') {
                    ?>
<span class="label label-primary">Featured<?php 
                } else {
                }
                ?>
</span>
                                    <span class="label <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['active'] == 'yes') {
                    ?>
label-success<?php 
                } else {
                    ?>
label-warning<?php 
                }
                ?>
 mlabel">
                                        <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['active'] == 'yes') {
                    ?>
Active<?php 
                } else {
                    ?>
InActive<?php 
                }
                ?>
</span>
                                    <span class="label <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['status'] == 'Successful') {
                    ?>
label-success<?php 
                } else {
                    ?>
label-warning<?php 
                }
                ?>
">
                                        <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['status'] == 'Successful') {
                    ?>
Successful<?php 
                } else {
                    ?>
Processing<?php 
                }
                ?>
</span>
                                    <span class="label label-info">
                                       Viewed <?php 
                echo niceTime($_smarty_tpl->tpl_vars['video']->value['last_viewed']);
                ?>
</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="row">
                        <?php 
                if ($_smarty_tpl->tpl_vars['video']->value['broadcast'] == 'public') {
                    ?>
                        <div class="col-md-1"><i class="icon-globe"></i></div>
                        <?php 
                } elseif ($_smarty_tpl->tpl_vars['video']->value['broadcast'] != 'public') {
                    ?>
                        <div class="col-md-1"><i class="icon-lock"></i></div>
                        <?php 
                }
                ?>
                    </div>
                    <a href="view_user.php?uid=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['userid'];
                ?>
"><?php 
                echo $_smarty_tpl->tpl_vars['video']->value['username'];
                ?>
</a>
                </div>
            </div>
        </td>
        <td>
            <div class="dropdown">
                <button id="dropdownMenu1" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown">
                    Actions <i class="caret"></i></button>
                <ul class="dropdown-menu pull-right" aria-labelledby="dropdownMenu1" role="menu">
                    <li><a role="menuitem" tabindex="-1"
                           href="<?php 
                echo $_smarty_tpl->tpl_vars['baseurl']->value;
                ?>
/edit_video.php?vid=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videoid'];
                ?>
" class="">Edit</a></li>
                    <li><a role="menuitem" tabindex="-1"
                           href="<?php 
                echo $_smarty_tpl->tpl_vars['baseurl']->value;
                ?>
/watch_video.php?v=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videokey'];
                ?>
"target="_blank">Watch</a>
                     
                   
                    
                    <li class="divider"></li>
                    <li><a role="menuitem" tabindex="-1" href="<?php 
                echo $_smarty_tpl->tpl_vars['baseurl']->value;
                ?>
/myaccount.php?delete_video=<?php 
                echo $_smarty_tpl->tpl_vars['video']->value['videoid'];
                ?>
">Delete</a>
                    </li>
                    <?php 
                $_smarty_tpl->tpl_vars['links'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['links']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['cbvid']->value->video_manager_links;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['links']->key => $_smarty_tpl->tpl_vars['links']->value) {
                    $_smarty_tpl->tpl_vars['links']->_loop = true;
                    ?>
                    <?php 
                    echo $_smarty_tpl->tpl_vars['cbvid']->value->video_manager_link($_smarty_tpl->tpl_vars['links']->value, $_smarty_tpl->tpl_vars['video']->value);
                    ?>

                    <?php 
                }
                ?>
                </ul>
            </div>
        </td>
    </tr>
    <?php 
            }
            ?>
</table>
<?php 
        } else {
            ?>
<div align="center"><strong><em>No Video Found</em></strong></div>
<?php 
        }
        ?>
</div>
<div class="flaggedtable accountprofile1">
    <table class="table table-bordered table-striped">
        <div id="fobjects" class="tab-pane" >
            <div class="widget-box">
                <td>
                    <div class="widget-header">
                        <h5><i class="glyphicon glyphicon-flag"></i>Flagged Objects</h5>
                    </div>

                    <div class="widget-body">

                        <div class="tabbable tabs-left">
                            <ul class="nav nav-tabs" id="myTab">
                                <li class="active">
                                    <a data-toggle="tab" href="#fvideos">Videos</a>
                                </li>

                                <li class="photos">
                                    <a data-toggle="tab" href="#fphotos">Photos</a>
                                </li>
                            </ul>
                            <br>
                            <div class="tab-content">
                                <div id="fvideos" class="tab-pane active">
                                    <?php 
        if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['list'])) {
            unset($_smarty_tpl->tpl_vars['smarty']->value['section']['list']);
        }
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['name'] = 'list';
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'] = is_array($_loop = $_smarty_tpl->tpl_vars['flagedVideos']->value) ? count($_loop) : max(0, (int) $_loop);
        unset($_loop);
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show'] = true;
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'];
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'] = 1;
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'] - 1;
        if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show']) {
            $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'];
            if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] == 0) {
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show'] = false;
            }
        } else {
            $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] = 0;
        }
        if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show']) {
            for ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total']; $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration']++) {
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['first'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] == 1;
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['last'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'];
                ?>
                                    <div class="row">
                                        <div class="col-md-3">
                                            <img src="<?php 
                echo getSmartyThumb(array('vdetails' => $_smarty_tpl->tpl_vars['flagedVideos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]), $_smarty_tpl);
                ?>
" width="85" height="70" id="thumbs_<?php 
                echo $_smarty_tpl->tpl_vars['flagedVideos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['videoid'];
                ?>
" title=""/>
                                        </div>
                                        <div class="col-md-6 fvideos">
                                            <?php 
                echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['flagedVideos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['title'], 50);
                ?>

                                        </div>

                                        <div class="col-md-7 fvideos">
                                            <label class="label label-danger">Uploaded  <?php 
                echo niceTime($_smarty_tpl->tpl_vars['flagedVideos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['date_added']);
                ?>
</label>
                                            <label class="label label-default"> <?php 
                echo smarty_lang(array('code' => 'views'), $_smarty_tpl);
                ?>
 : <?php 
                echo number_format($_smarty_tpl->tpl_vars['flagedVideos']->value['views']);
                ?>
</label>
                                            <label class="label label-primary"> Flags:<?php 
                echo $_smarty_tpl->tpl_vars['flagedVideos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['total_flags'];
                ?>
</label>
                                        </div>
                                    </div>
                                    <hr class="newhr">
                                    <?php 
            }
        }
        ?>
                                </div>
                                <div id="fphotos" class="tab-pane">
                                    <?php 
        if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['list'])) {
            unset($_smarty_tpl->tpl_vars['smarty']->value['section']['list']);
        }
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['name'] = 'list';
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'] = is_array($_loop = $_smarty_tpl->tpl_vars['flagedPhotos']->value) ? count($_loop) : max(0, (int) $_loop);
        unset($_loop);
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show'] = true;
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'];
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'] = 1;
        $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'] - 1;
        if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show']) {
            $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['loop'];
            if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] == 0) {
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show'] = false;
            }
        } else {
            $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'] = 0;
        }
        if ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['show']) {
            for ($_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total']; $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration']++) {
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['step'];
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['first'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] == 1;
                $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['last'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['list']['total'];
                ?>
                                    <div class="row">
                                        <div class="col-md-3">
                                            <img src="<?php 
                echo getSmartyThumb(array('vdetails' => $_smarty_tpl->tpl_vars['flagedPhotos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]), $_smarty_tpl);
                ?>
" width="85" height="70" id="thumbs_<?php 
                echo $_smarty_tpl->tpl_vars['flagedPhotos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['photoid'];
                ?>
" title=""/>
                                        </div>
                                        <div class="col-md-6 fusers">
                                            <?php 
                echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['flagedphotos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['title'], 50);
                ?>

                                        </div>
                                        <div class="col-md-2">
                                            <strong class="btn btn-primary btn-xs pull-right"> Flags:<?php 
                echo $_smarty_tpl->tpl_vars['flagedPhotos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['total_flags'];
                ?>
</strong>
                                        </div>
                                        <div class="col-md-7 fusers">
                                            <label class="label label-danger">Uploaded  <?php 
                echo niceTime($_smarty_tpl->tpl_vars['flagedPhotos']->value[$_smarty_tpl->getVariable('smarty')->value['section']['list']['index']]['date_added']);
                ?>
</label>
                                            <label class="label label-default"> <?php 
                echo smarty_lang(array('code' => 'views'), $_smarty_tpl);
                ?>
 : <?php 
                echo number_format($_smarty_tpl->tpl_vars['flagedPhotos']->value['views']);
                ?>
</label>

                                        </div>
                                    </div>
                                    <?php 
            }
        }
        ?>
                                </div>
                            </div>
                        </div>
                        <!-- /widget-main -->
                    </div><!-- /widget-body -->
            </div>
        </div>
    </table>
</div>




<div class="col-md-12">
    <div class="padding38">
        <?php 
        if ($_smarty_tpl->tpl_vars['user']->value['userid'] == userid()) {
            ?>
        <button class="btn btn-primary new1" style="background-color: #000000;color: white">
            <span class="line-height-1 bigger-170 blue"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['total_videos'];
            ?>
</span>
            <br>
            <span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Videos'), $_smarty_tpl);
            ?>
 </span>
        </button>
            <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['total_photos'];
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> Photos </span>
												</span>
    <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['num_visits']);
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'total_logins'), $_smarty_tpl);
            ?>
 </span>
												</span>
    <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_watched']);
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Watched'), $_smarty_tpl);
            ?>
 </span>
												</span>
    <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_comments']);
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Comments'), $_smarty_tpl);
            ?>
 </span>
												</span>
    <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_collections']);
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Collections'), $_smarty_tpl);
            ?>
 </span>
												</span>
            <span class="btn btn-primary new1" style="background-color: #000000; color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['profile_hits'];
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Views'), $_smarty_tpl);
            ?>
 </span>
												</span>
            <span class="btn btn-primary new1" style="background-color: #000000;color: #ffffff">
													<span class="line-height-1 bigger-170 blue"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['subscribers'];
            ?>
</span>
													<br>
													<span class="line-height-1 smaller-90 new1"> <?php 
            echo smarty_lang(array('code' => 'Subscribers'), $_smarty_tpl);
            ?>
 </span>
												</span>
        <?php 
        }
        ?>
    </div>
</div><?php 
    }
예제 #28
0
 function Giftbox()
 {
     AddLog2('GiftBox: Start');
     $T = time(true);
     // begin SQL setup
     $this->GBDBuser_init("Hook");
     $this->GB_renew_giftbox_SQL();
     // end SQL setup
     // Get the settings
     $GBSQL = "SELECT _val,_set FROM gamesettings";
     $result = $this->_GBUser->query($GBSQL);
     if ($result->numRows() > 0) {
         $GB_results = $result->fetchAll();
         foreach ($GB_results as $GB_result) {
             $this->GB_Setting[$GB_result['_set']] = $GB_result['_val'];
         }
     }
     // import default actions?
     $this->GB_AutoActionFile();
     // if place is on, than let's update the locations to find empty locations
     if ($this->GB_Setting['DoPlace']) {
         $this->GBCreateMap();
     }
     AddLog2('GiftBox: Detecting Building Parts');
     $this->GB_DetectBuildingParts4();
     $this->GB_BuildingParts4();
     if ($this->GB_Setting['RunPlugin']) {
         //check the cellar for storage.
         if ($this->GB_Setting['DoStorage']) {
             $this->GB_checkCellar();
         }
         // check this amount of items in giftbox.
         $result1 = $this->_GBUser->query("SELECT SUM(_amount) FROM giftbox");
         if ($result1->numRows() > 0) {
             $GB_total_in_giftbox = $result1->fetchSingle();
         } else {
             $GB_total_in_giftbox = 0;
         }
         AddLog2("GiftBox: Items Counted - " . $GB_total_in_giftbox);
         global $GB_tempid;
         if ($GB_tempid == "") {
             $GB_tempid = 63000;
         }
         //get the collection info.
         $GBccount = array();
         $GBccount = GB_LoadCcount();
         $GB_changed = false;
         //true when we did action.
         $MAP_ObjectArray = array();
         $Map_all_items = array();
         $MapXY = array();
         $EmptyXY = array();
         if ($this->GB_Setting['DoFeetPet']) {
             AddLog2("GiftBox: Detecting Pet(s)");
             $GB_Pets = $this->GB_FindPetsSQL();
             $found = count(array_keys($GB_Pets));
             AddLog2("GiftBox: Found {$found} Pet(s)");
             if ($found > 0) {
                 foreach ($GB_Pets as $GB_Petfeed) {
                     if ($GB_Petfeed['isRunAway'] == 1) {
                         AddLog2('GiftBox: ' . $GB_Petfeed['petName'] . ' Has Ran Away');
                     } else {
                         $FeedWhat = $GB_Petfeed['FeedWhat'];
                         $FeedName = $GB_Petfeed['petName'];
                         AddLog2('GiftBox: ' . $FeedName . ' Needs: ' . $FeedWhat . ' ' . nicetime($GB_Petfeed['feedtime']));
                     }
                 }
             }
         }
         // DoFeetPet
         // load the totstorage.
         $GBSQL = "SELECT * FROM totstorage ";
         $query = $this->_GBUser->query($GBSQL);
         $totstorages = $query->fetchAll();
         if (!is_array($totstorages)) {
             $totstorages = array();
         }
         // load the giftbox...
         $GBSQL = "SELECT * FROM giftbox ";
         $query = $this->_GBUser->query($GBSQL);
         $giftboxs = $query->fetchAll();
         foreach ($giftboxs as $giftbox) {
             $GB_ItemCode = $giftbox["_itemcode"];
             $GB_ItemAmount = $giftbox["_amount"];
             // if items = 0 then skip this item.
             if ($GB_ItemAmount < 1) {
                 continue;
             }
             $place_on_farm = '';
             $place_in_build = '';
             $place_in_amount = '';
             $place_in_max = '';
             $place_in_special = '';
             $target = '';
             $selling = '';
             $keep = 0;
             $construction = '';
             $collection = '';
             $consume = '';
             //  Let's check if there is action for this item.
             $GBSQL = "SELECT * FROM action WHERE _code = '" . $GB_ItemCode . "'";
             $query = $this->_GBUser->query($GBSQL);
             $action = $query->fetchAll();
             if (!empty($action)) {
                 // so there is action.
                 $place_on_farm = $action['0']['_place_on_farm'];
                 $place_in_build = $action['0']['_place_in_build'];
                 $place_in_amount = $action['0']['_place_in_amount'];
                 $place_in_max = $action['0']['_place_in_max'];
                 $place_in_special = $action['0']['_place_in_special'];
                 $target = $action['0']['_target'];
                 $selling = $action['0']['_selling'];
                 $construction = $action['0']['_construction'];
                 $keep = $action['0']['_keep'];
                 $collection = $action['0']['_collection'];
                 $consume = $action['0']['_consume'];
             }
             // prepare Unit settings
             $GBSQL = "SELECT * FROM units WHERE _code = '" . $GB_ItemCode . "' ";
             $query = $this->_GBMain->query($GBSQL);
             $Unit = $query->fetchAll();
             // Get the realname
             $Unit['0']['realname'] = $this->GB_get_friendlyName($Unit['0']['_name']);
             // check if we need to feed pet
             $FeedNowCheck = false;
             $PetFeedFound = "";
             if ($GB_ItemCode == "0O") {
                 $FeedNowCheck = true;
                 $PetFeedFound = "Puppy Kibble ";
             }
             if ($GB_ItemCode == "0z") {
                 $FeedNowCheck = true;
                 $PetFeedFound = "Dog Treat ";
             }
             if ($FeedNowCheck == true && $this->GB_Setting['DoFeetPet']) {
                 AddLog('GiftBox: ' . $GB_ItemAmount . " " . $PetFeedFound . " Found - Checking If Needed");
                 if ($GB_ItemAmount > 0) {
                     // loop all pets
                     foreach ($GB_Pets as $GB_Petfeed) {
                         if ($GB_Petfeed['isRunAway'] == 1) {
                             AddLog2('GiftBox: ' . $GB_Petfeed['petName'] . ' Has Ran Away - Cannot Feed');
                         } else {
                             $FeedWhat = $GB_Petfeed['FeedWhat'];
                             $FeedName = $GB_Petfeed['petName'];
                             $FeedNow = true;
                             if ($FeedWhat == "kibble" && $GB_ItemCode == "0z") {
                                 AddLog2("GiftBox: This Puppy Does Not Need Dog Treats..");
                                 $FeedNow = false;
                             }
                             if ($FeedWhat == "treat" && $GB_ItemCode == "0O") {
                                 AddLog2("GiftBox: This Dog Does Not Need Kibble..");
                                 $FeedNow = false;
                             }
                             if ($FeedNow == true) {
                                 $UnixNow = time();
                                 if ($UnixNow > $GB_Petfeed['feedtime']) {
                                     // need feed now
                                     $FeedWhat = $GB_Petfeed['FeedWhat'];
                                     $result = GB_consumePet($GB_Petfeed['id'], "consume_" . $FeedWhat);
                                     AddLog2("GiftBox: Feeding " . $GB_Petfeed['petName'] . " " . $FeedWhat . '- ' . $result);
                                     if ($result == "OK") {
                                         AddLog2("GiftBox: Kibble Has Been Fed");
                                         $GB_changed = true;
                                         // giftbox changed
                                         $this->GB_Stat3($GB_ItemCode, "Pet feed", $GB_ItemAmount, "Pet Feed");
                                         //GB_Stat($GB_ItemCode, "Kibble feed", 0, 0, $GB_ItemAmount,0 );
                                     } else {
                                         $giftboxs = array();
                                         break;
                                     }
                                 } else {
                                     AddLog2($GB_Petfeed['petName'] . ' Needs to be Fed ' . nicetime($GB_Petfeed['feedtime']));
                                 }
                             }
                         }
                     }
                 }
             }
             // End pet feet.
             // check target settings global.
             if ($target != 0) {
                 $Target = $this->GBSQLGetObjByID($target);
                 $TotItems = 0;
                 $TargetItemHave = 0;
                 // map the content of the target and find the total items have
                 if (is_array($Target['contents'])) {
                     // count the contents
                     foreach ($Target['contents'] as $content) {
                         $TotItems = $TotItems + $content['numItem'];
                         $TargetCont[$content['itemCode']] = $content['numItem'];
                         if ($GB_ItemCode == $content['itemCode']) {
                             $TargetItemHave = $content['numItem'];
                         }
                     }
                 }
                 // end contents
                 // now check if the item is in totstorage.
                 $featureCreditsName = 'N';
                 if ($Target['itemName'] == 'valentinesbox') {
                     $featureCreditsName = 'valentine';
                 }
                 if ($Target['itemName'] == 'potofgold') {
                     $featureCreditsName = 'potOfGold';
                 }
                 if ($Target['itemName'] == 'easterbasket') {
                     $featureCreditsName = 'easterBasket';
                 }
                 if ($Target['itemName'] == 'wedding') {
                     $featureCreditsName = 'tuscanWedding';
                 }
                 if ($Target['itemName'] == 'beehive_finished') {
                     $featureCreditsName = 'beehive';
                 }
                 if ($Target['itemName'] == 'hatchstorage') {
                     $featureCreditsName = 'InventoryCellar';
                 }
                 //added
                 if ($featureCreditsName != 'N') {
                     $GBSQL = "SELECT * FROM totstorage WHERE _storagecode = '" . $featureCreditsName . "' AND _itemcode = 'current'";
                     $query = $this->_GBUser->query($GBSQL);
                     if ($query->numRows() > 0) {
                         $totstorage = $query->fetchAll();
                         $TotItems = $totstorages['0']['_amount'];
                     }
                 }
                 // Get target unit details.
                 $GBSQL = "SELECT * FROM units WHERE _name = '" . $Target['itemName'] . "' ";
                 $result = $this->_GBMain->query($GBSQL);
                 $TargetUnit = $result->fetchAll();
                 // check capacity of target
                 $TargetCapacity = 0;
                 if (!array_key_exists('isFullyBuilt', $Target)) {
                     $Target['isFullyBuilt'] = "N";
                 }
                 if ($Target['isFullyBuilt'] == "1") {
                     $TargetCapacity = $TargetUnit['0']['_capacity'];
                     if (array_key_exists('expansionLevel', $Target)) {
                         $level = $Target['expansionLevel'];
                         if ($level > 1) {
                             $GBSQL = "SELECT _capacity FROM unitbuilding WHERE _level = '" . $level . "' AND _buildingcode = '" . $TargetUnit['0']['_code'] . "' ";
                             $result = $this->_GBMain->query($GBSQL);
                             $TargetCapacity = $result->fetchSingle();
                         }
                     } else {
                         $level = 0;
                     }
                 }
                 // end fully build
                 // check if building is in construction
                 $TargetIsConstruction = 'N';
                 if ($Target['state'] == 'construction') {
                     $TargetIsConstruction = 'Y';
                 } else {
                     // check if it is a horsestable
                     if ($Target['itemName'] == 'horsestablewhite') {
                         // check if horse stable has expansionParts
                         if (count(array_keys($Target['expansionParts'])) > 0) {
                             // yes, we have  expansionParts
                             $TargetIsConstruction = 'Y';
                         }
                         if ($TargetItemHave > 0) {
                             // yes, we have  expansionParts
                             $TargetIsConstruction = 'Y';
                         }
                     }
                 }
             }
             // End check target
             //check if we can store this item.
             if ($this->GB_Setting['DoStorage']) {
                 $Able2Store = GB_CanWeStore($Unit['0']);
                 if ($this->GB_Setting['StorageLocation'] == 'N') {
                     $Able2Store = 'N';
                 } else {
                     if ($this->GB_Setting['StorageUsed'] >= $this->GB_Setting['StorageCapacity']) {
                         // storage is full.
                         $Able2Store = 'N';
                         AddLog2("GiftBox: Storage is Full?");
                     }
                 }
                 if ($this->GB_Setting['DoStorage'] && $Able2Store == 'Y' && $GB_ItemAmount > 0) {
                     // check content of storage
                     AddLog2("GiftBox: Entering Storage Routine For: " . $Unit['0']['realname']);
                     $cellars = unserialize($this->GB_Setting['StorageContent2']);
                     $AmountInCellar = 0;
                     if (array_key_exists($GB_ItemCode, $cellars)) {
                         $AmountInCellar = $cellars[$GB_ItemCode];
                     }
                     AddLog2("GiftBox: Store " . $GB_ItemAmount . " " . $Unit['0']['realname'] . '?');
                     if ($this->GB_Setting['DoStorage1'] && $AmountInCellar < 1) {
                         $Amount2Store = 1;
                         AddLog2("GiftBox: Store " . $Amount2Store . " " . $Unit['0']['realname']);
                     } else {
                         AddLog2("GiftBox: Store " . $Unit['0']['realname'] . " Already in Storage");
                     }
                     if ($Amount2Store > 0) {
                         $result = GB_StoreCel($Unit['0'], $Amount2Store);
                         if ($result == "OK") {
                             AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - Added");
                             $GB_changed = true;
                             // giftbox changed
                             $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Fuel added");
                             $GB_ItemAmount = $GB_ItemAmount - $Amount2Store;
                         } else {
                             $giftboxs = array();
                             break;
                         }
                     } else {
                         AddLog2("GiftBox: No Need to Store This Item.");
                     }
                 }
                 // end stor
             }
             // check if we can use the item to store into a building
             if ($place_in_build != 0 && $target != 0 && $this->GB_Setting['DoPlaceBuild'] && $GB_ItemAmount > 0) {
                 //$place_in_max
                 AddLog2('GiftBox ' . $Target['itemName'] . ' - Capacity: ' . $TargetCapacity . ' - Have: ' . $TotItems);
                 $finished = false;
                 if ($TotItems >= $TargetCapacity) {
                     // The building is full lets skip this item.
                     AddLog2("GiftBox: This Building is Full - Skipping");
                     $finished = true;
                 }
                 while (!$finished) {
                     $result = GB_storeItem($Unit['0'], $Target);
                     if ($result == "OK") {
                         $GB_changed = true;
                         //update the amount.
                         AddLog2('GiftBox: Placed in Building ' . $Unit['0']['_name'] . ' - Total in Building: ' . $TotItems);
                         $this->GB_SQL_updAction("_place_in_build", $GB_ItemCode, $place_in_build - $GB_ItemAmount);
                         //$field, $code, $val
                         //update stats.
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Into building");
                         $TotItems++;
                         $GB_ItemAmount--;
                     } else {
                         $finished = true;
                         $giftboxs = array();
                         break;
                     }
                     if ($TotItems >= $TargetCapacity) {
                         $finished = true;
                     }
                     if ($GB_ItemAmount < 1) {
                         $finished = true;
                     }
                 }
                 // not full
             }
             //end place in build
             // check if we have to place construction in a building
             // construction = # or Y    0 = not construction
             if ($construction == 'Y' && $this->GB_Setting['DoConstr'] && $GB_ItemAmount > 0) {
                 $go = $GB_ItemAmount;
                 $used = 0;
                 while ($go > 0) {
                     AddLog2('GiftBox: Construction Part ' . $Unit['0']['_name'] . ' Found  ' . $go);
                     $GBSQL = "SELECT * FROM BuildingParts WHERE _itemCode = " . $this->Qs($GB_ItemCode) . " AND _action ='construction' AND _ObjHave < 10 LIMIT " . $go;
                     $query = $this->_GBUser->query($GBSQL);
                     if ($query->numRows() > 0) {
                         $BuildingParts = $query->fetchAll();
                         foreach ($BuildingParts as $BuildingPart) {
                             // 1 or more targets found
                             $Target = $this->GBSQLGetObjByID($BuildingPart['_ObjId']);
                             AddLog2('GiftBox: Part: ' . $BuildingPart['_itemName'] . ' For ' . $BuildingPart['_UnitBuildName'] . " - Contains: " . $BuildingPart['_ObjHave'] . " - Adding 1");
                             $result = GB_storeItem($Unit['0'], $Target);
                             if ($result == "OK") {
                                 $GB_changed = true;
                                 $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Construction");
                                 //update the amount have
                                 $have = $BuildingPart['_ObjHave'] + 1;
                                 $GBSQL = "UPDATE BuildingParts SET _ObjHave=" . $this->Qs($have) . " WHERE _UnitBuildName = " . $this->Qs($BuildingPart['_UnitBuildName']) . " AND _itemCode = " . $this->Qs($GB_ItemCode);
                                 $query = $this->_GBUser->query($GBSQL);
                                 $go--;
                                 $used++;
                             } else {
                                 $go = 0;
                                 $giftboxs = array();
                                 break;
                             }
                         }
                     } else {
                         //skip there are no target buildings
                         AddLog2('GiftBox: Construction Part Not Needed. (' . $GB_ItemCode . ')');
                         $go = 0;
                     }
                 }
                 // while $GB_ItemAmount > 1
                 $GB_ItemAmount = $GB_ItemAmount - $used;
             }
             // constructions
             // check if we have Special to handle
             if ($place_in_special != 0 && $target != 0 && $this->GB_Setting['DoSpecials'] && $GB_ItemAmount > 0) {
                 AddLog2('GiftBox: Special ' . $TargetUnit['0']['_name'] . " For " . $Target['itemName']);
                 // for specials there is no max.
                 $result = GB_storeItem2($Unit['0'], $Target, $GB_ItemAmount);
                 if ($result == "OK") {
                     //GB_SpecialThisUpdate($GB_ItemCode, $GB_ItemAmount);
                     $GB_changed = true;
                     $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Special");
                     $GB_ItemAmount = 0;
                 } else {
                     $giftboxs = array();
                     break;
                 }
             }
             // check if we have collection
             if ($collection == 'Y' && $this->GB_Setting['DoColl'] && $GB_ItemAmount > 0) {
                 $Amount_in_Collection = GB_GetColInfo($GB_ItemCode, $GBccount);
                 // Check if we have less than 10
                 if ($Amount_in_Collection < 10 && $GB_ItemAmount > 0) {
                     if ($Amount_in_Collection + $GB_ItemAmount <= 10) {
                         $Amount_to_add = $GB_ItemAmount;
                     } else {
                         $Amount_to_add = 10 - $Amount_in_Collection;
                     }
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['_name'] . " - Have " . $Amount_in_Collection . " Will Add " . $Amount_to_add . " To Collection");
                     $result = GB_DoColAdd($Unit['0']['_name'], $GB_ItemCode, $Amount_to_add);
                     if ($result == "OK") {
                         AddLog2($Amount_to_add . " " . $Unit['0']['_name'] . " Added To Collection");
                         $GB_changed = true;
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Added collection");
                         $Amount_in_Collection = $Amount_in_Collection + $Amount_to_add;
                         $GB_ItemAmount = $GB_ItemAmount - $Amount_to_add;
                     } else {
                         $giftboxs = array();
                         break;
                     }
                 }
                 // end < 10
                 if ($Amount_in_Collection >= 10 && $GB_ItemAmount > 0) {
                     //we have already 10
                     if ($this->GB_Setting['DoCollSell']) {
                         AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['_name'] . " - Have " . $Amount_in_Collection . " Will Sell Now");
                         $result = GB_DoSellCol($Unit['0'], $GB_ItemAmount);
                         if ($result == "OK") {
                             AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Sold");
                             $GB_changed = true;
                             $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Sold collection");
                         } else {
                             $giftboxs = array();
                             break;
                         }
                     } else {
                         AddLog2("GiftBox: " . $GB_ItemAmount . " " . $ObjD['realname'] . " - Have " . $Amount_in_Collection . " Selling Disabled");
                     }
                     // end do_sell
                 }
                 // end more 10.
             }
             // end collection
             // Place on farm
             if ($place_on_farm == 'Y' && $this->GB_Setting['DoPlace'] && $GB_ItemAmount > 0) {
                 AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - Place on Farm");
                 $GB_Where = "Decoration";
                 if ($Unit['0']['_type'] == "animal") {
                     $GB_Where = "Animal";
                 }
                 if ($Unit['0']['_type'] == "tree") {
                     $GB_Where = "Tree";
                 }
                 //check if there is place on the farm.
                 $GB_Free_place = $this->TEmptyXY3($GB_Where, "ALL");
                 if ($GB_Free_place < $GB_ItemAmount) {
                     AddLog2("****** Error *****");
                     AddLog2("GiftBox: There is no room on you farm left.");
                     AddLog2("GiftBox: To place: " . $GB_ItemAmount . " " . $Unit['0']['realname']);
                     AddLog2("****** Error *****");
                 } else {
                     $result = GB_PlaceM3($Unit['0'], $GB_ItemAmount, $GB_Where);
                     if ($result == "OK") {
                         AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Placed");
                         $GB_changed = true;
                         // giftbox changed
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Placed");
                         $GB_ItemAmount = 0;
                     } else {
                         $giftboxs = array();
                         break;
                     }
                 }
             }
             // end place
             if ($Unit['0']['_type'] == 'fuel' && $this->GB_Setting['DoFuel'] && $GB_ItemAmount > 0) {
                 // selling fuel enabled   >> GB_BuyFuel($ObjD , $GB_amount)
                 $result = GB_BuyFuel($Unit['0'], $GB_ItemAmount);
                 AddLog2("GiftBox " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Fuel found - " . $result);
                 if ($result == "OK") {
                     AddLog2("GiftBox " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Added");
                     $GB_changed = true;
                     // giftbox changed
                     $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GB_ItemAmount, "Fuel added");
                     $GB_ItemAmount = 0;
                 } else {
                     $giftboxs = array();
                     break;
                 }
             }
             // end fuel
             // consumable
             if ($consume == 'Y' && $GB_ItemAmount > 0) {
                 $GBAction_Amount = $GB_ItemAmount - $keep;
                 if ($GBAction_Amount >= 1) {
                     $result = GB_consume($Unit['0'], $GBAction_Amount);
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Consume - Leave in GiftBox: " . $keep . ' - ' . $result);
                     $need_reload = true;
                     if ($result == "OK") {
                         AddLog2("GiftBox: " . $GBAction_Amount . " " . $Unit['0']['realname'] . " Consumed");
                         $GB_changed = true;
                         // giftbox changed
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GBAction_Amount, "Consume");
                         $GB_ItemAmount = 0;
                     } else {
                         DoInit();
                         $giftboxs = array();
                         break;
                     }
                 } else {
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - Keep in Giftbox: " . $keep);
                 }
             }
             // end consumable
             // DoVehicle
             if ($this->GB_Setting['DoVehicle'] && $GB_ItemCode == "dS" && $GB_ItemAmount > 0) {
                 $GBAction_Amount = $GB_ItemAmount - $keep;
                 $vehicle = $this->GB_garage('hook');
                 $AmountOfRuns = $vehicle['0']['vehicle'];
                 AddLog2("GiftBox: Have " . $GB_ItemAmount . " Vehicle Parts - " . $vehicle['0']['vehicle'] . " Vehicles Need Parts");
                 while ($AmountOfRuns >= 1 && $GBAction_Amount > 1) {
                     $needpart = $vehicle[$AmountOfRuns]['need'];
                     AddLog2("Giftbox: Vehicle " . $vehicle[$AmountOfRuns]['itemCode'] . " Needs " . $needpart . " Parts");
                     while ($needpart >= 1 && $GBAction_Amount > 1) {
                         $result = GB_DoGarage($vehicle[$AmountOfRuns], $vehicle['0']['id']);
                         if ($result == "OK") {
                             $vehicle[$AmountOfRuns]['numParts'] = $vehicle[$AmountOfRuns]['numParts'] + 1;
                             $needpart--;
                             AddLog2("GiftBox: 1 " . $Unit['0']['realname'] . " Added, Need " . $needpart . ' More');
                             $GB_changed = true;
                             // giftbox changed
                             $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GBAction_Amount, "Added");
                             $GBAction_Amount--;
                             $GB_ItemAmount--;
                         } else {
                             $giftboxs = array();
                             break;
                         }
                     }
                     $AmountOfRuns--;
                 }
             }
             // end DoVehicle
             // check if we can open this.
             $GB_OpenArray = unserialize($this->GB_Setting['OpenItems']);
             if (in_array($GB_ItemCode, $GB_OpenArray)) {
                 $GB_OpenThis = 'Y';
             } else {
                 $GB_OpenThis = 'N';
             }
             if ($this->GB_Setting['DoMystery'] && $GB_ItemAmount > 0 && $GB_OpenThis == 'Y') {
                 $GBAction_Amount = $GB_ItemAmount - $keep;
                 if ($GBAction_Amount >= 1) {
                     $result = GB_OpenGift($Unit['0'], $GBAction_Amount);
                     AddLog2("GiftBox: Open " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - " . $result);
                     $need_reload = true;
                     if ($result == "OK") {
                         AddLog2("GiftBox: Opened " . $GBAction_Amount . " " . $Unit['0']['realname'] . " - Done");
                         $GB_changed = true;
                         // giftbox changed
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GBAction_Amount, "Opened");
                         $GB_ItemAmount = 0;
                     } else {
                         $giftboxs = array();
                         break;
                     }
                 } else {
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - Keep in GiftBox: " . $keep);
                 }
             }
             // end open
             if ($selling == 'Y' && $this->GB_Setting['DoSelling'] && $GB_ItemAmount > 0) {
                 $GBAction_Amount = $GB_ItemAmount - $keep;
                 if ($GBAction_Amount >= 1) {
                     $result = GB_DoSellCol($Unit['0'], $GBAction_Amount);
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " Will be Sold - Leave in GiftBox: " . $keep . ' - ' . $result);
                     $need_reload = true;
                     if ($result == "OK") {
                         AddLog2("GiftBox: " . $GBAction_Amount . " " . $Unit['0']['realname'] . " Sold");
                         $GB_changed = true;
                         // giftbox changed
                         $this->GB_Stat3($GB_ItemCode, $Unit['0']['_name'], $GBAction_Amount, "Sold");
                         $GB_ItemAmount = 0;
                     } else {
                         $giftboxs = array();
                         break;
                     }
                 } else {
                     AddLog2("GiftBox: " . $GB_ItemAmount . " " . $Unit['0']['realname'] . " - Keep in GiftBox: " . $keep);
                 }
             }
             // end Do_SellList
         }
         //end foreach giftbox
         // after giftbox, see the collection trade in.
         if ($this->GB_Setting['DoCollTrade']) {
             // now look to complete collections.
             AddLog2("Collection trade in set to: " . $this->GB_Setting['DoCollKeep']);
             $GB_CollCompete_res = GB_CollCompete();
             // get the information
             while (list($GB_CollCode, $amount) = each($GB_CollCompete_res)) {
                 AddLog2("Collection Info: [" . $GB_CollCode . "] has" . $amount . " completed");
                 $GB_Tradein_amount = $amount - $this->GB_Setting['DoCollKeep'];
                 if ($GB_Tradein_amount > 0) {
                     $GB_TradeIn_res = GB_TradeIn($GB_CollCode, $GB_Tradein_amount);
                     AddLog2("Collection Trade In: [" . $GB_CollCode . "] " . $GB_Tradein_amount . " Time(s)");
                     $this->GB_Stat3($GB_CollCode, "Collection", $GB_Tradein_amount, "Trade in");
                     $GB_changed = true;
                 }
             }
         }
         // end complete collection
     } else {
         AddLog2("Skipping GiftBox...");
     }
     if ($GB_changed) {
         $res = $this->GB_renew_giftbox_SQL();
         // update giftbox. so it shows correctly in the screen.
     } else {
         $T2 = time();
         $T2 -= $T;
         AddLog2("Giftbox: Finished in " . $T2 . " Seconds");
     }
 }
예제 #29
0
function act_admin_stats()
{
    global $wpdb, $options_act;
    if (isset($_POST['act_date_start']) && isset($_POST['act_date_end']) && check_admin_referer('act_stats', 'act_stats')) {
        $act_d_s_tab = explode('/', esc_html($_POST['act_date_start']));
        $act_d_e_tab = explode('/', esc_html($_POST['act_date_end']));
        switch ($options_act['act_date_format']) {
            case "dd/mm/yyyy":
                $act_date_start = $act_d_s_tab[2] . '/' . $act_d_s_tab[1] . '/' . $act_d_s_tab[0];
                $act_date_end = $act_d_e_tab[2] . '/' . $act_d_e_tab[1] . '/' . $act_d_e_tab[0];
                break;
            case "mm/dd/yyyy":
                $act_date_start = $act_d_s_tab[2] . '/' . $act_d_s_tab[0] . '/' . $act_d_s_tab[1];
                $act_date_end = $act_d_e_tab[2] . '/' . $act_d_e_tab[0] . '/' . $act_d_e_tab[1];
                break;
            default:
                $act_date_start = esc_html($_POST['act_date_start']);
                $act_date_end = esc_html($_POST['act_date_end']);
        }
    } else {
        $act_date_start = date('Y-m-d', time() - 604800);
        $act_date_end = date('Y-m-d');
    }
    if (isset($_GET['act_filter']) && check_admin_referer('wp-activity-list', 'act_stats')) {
        if (isset($_GET['act_date_start']) && isset($_GET['act_date_end'])) {
            $act_date_start = $_GET['act_date_start'];
            $act_date_end = $_GET['act_date_end'];
        } else {
            $act_date_start = date('Y-m-d', time() - 604800);
            $act_date_end = date('Y-m-d');
        }
        $act_filter = esc_html($_GET['act_filter']);
    } else {
        $act_filter = "CONNECT";
    }
    switch ($options_act['act_date_format']) {
        case "dd/mm/yyyy":
            $act_date_format_js = "dd/mm/yy";
            $act_df_xaxis = "%0d %b";
            break;
        case "mm/dd/yyyy":
            $act_date_format_js = "mm/dd/yy";
            $act_df_xaxis = "%b %0d";
            break;
        default:
            $act_date_format_js = "yy/mm/dd";
            $act_df_xaxis = "%b %0d";
    }
    $sql = "SELECT * FROM " . $wpdb->prefix . "activity WHERE act_date BETWEEN '" . $act_date_start . "' AND '" . $act_date_end . " 23:59:59' ORDER BY act_type ASC, act_date ASC";
    //We need to set h:m:s as they are by default 00:00:00
    if ($act_events = $wpdb->get_results($sql)) {
        $act_events_tab = array();
        $act_type = '';
        foreach ((array) $act_events as $act_event) {
            if ($act_event->act_type != $act_type) {
                $act_type = $act_event->act_type;
                $act_events_tab[$act_type] = 0;
            }
            $act_events_tab[$act_type] += 1;
        }
    }
    $sqlfilter = "SELECT DATE_FORMAT(act_date, '%Y-%m-%d') as act_date FROM " . $wpdb->prefix . "activity WHERE act_type = '" . $act_filter . "' AND act_date BETWEEN '" . $act_date_start . "' AND '" . $act_date_end . " 23:59:59' ORDER BY act_type ASC, act_date ASC";
    //We need to set h:m:s as they are by default 00:00:00
    if ($act_filter_r = $wpdb->get_results($sqlfilter)) {
        $act_filter_tab = array();
        $act_date = '';
        foreach ((array) $act_filter_r as $act_event) {
            if (strtotime($act_event->act_date) != $act_date) {
                $act_date = strtotime($act_event->act_date);
                $act_filter_tab[$act_date] = 0;
            }
            $act_filter_tab[$act_date] += 1;
        }
    }
    $act_nonce = wp_create_nonce('wp-activity-list');
    $act_tab_types = array('CONNECT' => __('Successful user login(s)', 'wp-activity'), 'NEW_USER' => __('New registered user(s)', 'wp-activity'), 'LOGIN_FAIL' => __('Login attempt(s) failed', 'wp-activity'), 'ACCESS_DENIED' => __('Access(es) denied', 'wp-activity'), 'PROFILE_EDIT' => __('Profile(s) edited', 'wp-activity'), 'POST_ADD' => __('Post(s) created', 'wp-activity'), 'POST_EDIT' => __('Post(s) edited', 'wp-activity'), 'POST_DEL' => __('Post(s) deleted', 'wp-activity'), 'COMMENT_ADD' => __('Comment(s) added', 'wp-activity'), 'LINK_ADD' => __('Link(s) added', 'wp-activity'));
    echo '<script>
        jQuery().ready(function($){
          $.datepicker.regional["ACT"] = {
        	closeText: "' . __('Close', 'wp-activity') . '",
        	prevText: "' . __('&#x3c;Prev', 'wp-activity') . '",
        	nextText: "' . __('Next&#x3e;', 'wp-activity') . '",
        	currentText: "' . __('Current', 'wp-activity') . '",
        	monthNames: ["' . __('January') . '","' . __('February') . '","' . __('March') . '","' . __('April') . '","' . __('May') . '","' . __('June') . '",
        	"' . __('July') . '","' . __('August') . '","' . __('September') . '","' . __('October') . '","' . __('November') . '","' . __('December') . '"],
        	monthNamesShort: ["' . short_date_translation('Jan') . '","' . short_date_translation('Fev') . '","' . short_date_translation('Mar') . '","' . short_date_translation('Apr') . '","' . short_date_translation('May') . '","' . short_date_translation('Jun') . '",
        	"' . short_date_translation('Jul') . '","' . short_date_translation('Aug') . '","' . short_date_translation('Sep') . '","' . short_date_translation('Oct') . '","' . short_date_translation('Nov') . '","' . short_date_translation('Dec') . '"],
        	dayNames: ["' . __('Sunday') . '","' . __('Monday') . '","' . __('Tuesday') . '","' . __('Wednesday') . '","' . __('Thursday') . '","' . __('Friday') . '","' . __('Saturday') . '"],
        	dayNamesShort: ["' . __('Sun') . '","' . __('Mon') . '","' . __('Tue') . '","' . __('Wed') . '","' . __('Thu') . '","' . __('Fri') . '","' . __('Sat') . '"],
        	dayNamesMin: ["' . __('S_Sunday_initial') . '","' . __('M_Monday_initial') . '","' . __('T_Tuesday_initial') . '","' . __('W_Wednesday_initial') . '","' . __('T_Thursday_initial') . '","' . __('F_Friday_initial') . '","' . __('S_Saturday_initial') . '"],
        	firstDay: ' . get_option('start_of_week') . ',
        	showMonthAfterYear: false,
        	yearSuffix: ""};
          $.datepicker.setDefaults($.datepicker.regional["ACT"]);
        });
        </script>';
    echo '<script>
        jQuery().ready(function ($) {
          var dates = $( "#act_date_start, #act_date_end" ).datepicker({
            dateFormat: "' . $act_date_format_js . '",
            changeMonth: true,
            changeYear: true,
        		numberOfMonths: 1,
        		onSelect: function( selectedDate ) {
        			var option = this.id == "act_date_start" ? "minDate" : "maxDate",
        				instance = $( this ).data( "datepicker" ),
        				date = $.datepicker.parseDate(
        					instance.settings.dateFormat ||
        					$.datepicker._defaults.dateFormat,
        					selectedDate, instance.settings );
        			dates.not( this ).datepicker( "option", option, date );
        		}
        	});
        });
      </script>';
    ?>
  
  <div class="wrap">
    <h2><?php 
    _e('Activity Stats', 'wp-activity');
    ?>
</h2>
    <br />
    <div class="tablenav">
      <form id="act_stats" method="post" action="?page=act_stats">
        <p class="search-box">
          <?php 
    _e("Date range", 'wp-activity');
    ?>
 : 
          <input type="text" id="act_date_start" name="act_date_start" value="<?php 
    echo nicetime($act_date_start, true, true);
    ?>
" />
          <input type="text" id="act_date_end" name="act_date_end" value="<?php 
    echo nicetime($act_date_end, true, true);
    ?>
" />
          <input type="submit" value="<?php 
    esc_attr_e('Apply');
    ?>
" name="doaction" id="doaction" class="button-secondary action" />
          <?php 
    wp_nonce_field('act_stats', 'act_stats');
    ?>
        </p>
      </form>
      <br class="clear" />
    </div>
    <div id="act_admin_wrap">
      <div id="dashboard-widgets" class="metabox-holder">
        <div id="dashboard_right_now" class="postbox">
          <h3><?php 
    _e('Activity Stats', 'wp-activity');
    ?>
</h3>
          <div class="inside">
            <div class="table table_content" style="width: 25%">
              <p class="sub"><?php 
    _e('Events number :', 'wp-activity');
    ?>
</p>
              <table>
                <tbody>
                  <?php 
    foreach ($act_tab_types as $act_tab_type => $act_tab_label) {
        ?>
                      <?php 
        if (($act_tab_type != 'LOGIN_FAIL' or $options_act['act_log_failures']) and ($act_tab_type != 'ACCESS_DENIED' or $options_act['act_blacklist_on'])) {
            $act_class = '';
            if ($act_tab_type == 'LOGIN_FAIL' or $act_tab_type == 'ACCESS_DENIED') {
                $act_class = 'class="spam"';
            }
            if ($act_tab_type == $act_filter) {
                $act_class = 'class="waiting"';
            }
            ?>
                      <tr>
                        <td class="first b"><a <?php 
            echo $act_class;
            ?>
 href="?page=act_stats&act_stats=<?php 
            echo $act_nonce;
            ?>
&act_filter=<?php 
            echo $act_tab_type;
            ?>
&act_date_start=<?php 
            echo $act_date_start;
            ?>
&act_date_end=<?php 
            echo $act_date_end;
            ?>
"><?php 
            echo isset($act_events_tab[$act_tab_type]) ? $act_events_tab[$act_tab_type] : '0';
            ?>
</a></td>
                        <td class="t"><a <?php 
            echo $act_class;
            ?>
 href="?page=act_stats&act_stats=<?php 
            echo $act_nonce;
            ?>
&act_filter=<?php 
            echo $act_tab_type;
            ?>
&act_date_start=<?php 
            echo $act_date_start;
            ?>
&act_date_end=<?php 
            echo $act_date_end;
            ?>
"><?php 
            echo $act_tab_label;
            ?>
</a> <a title="<?php 
            echo __('See data for', 'wp-activity') . ' : ' . $act_tab_label;
            ?>
" href="?page=act_activity&act_filter=<?php 
            echo $act_nonce;
            ?>
&act_type_filter=<?php 
            echo $act_tab_type;
            ?>
"><img class="act_data_report_icon" src="<?php 
            echo WP_PLUGIN_URL;
            ?>
/wp-activity/img/report_data.png" alt="" /></a></td>
                      </tr>
                      <?php 
        }
        ?>
                  <?php 
    }
    ?>
                </tbody>
              </table>
            </div>
            <div class="table table_discussion" style="width: 65%">
              <p class="sub"><?php 
    echo $act_tab_types[$act_filter];
    ?>
</p>
              <div id="act_cat_graphs" style="width:98%;height:250px;"></div>
              <script type="text/javascript">
                jQuery().ready(function ($) {
                  xmin = <?php 
    echo number_format(strtotime($act_date_start) * 1000, 0, '.', '');
    ?>
;
                  xmax = <?php 
    echo number_format(strtotime($act_date_end . " 23:59:59") * 1000, 0, '.', '');
    ?>
;
                  var d1 = [
                  <?php 
    $act_disp = '';
    foreach ($act_filter_tab as $act_date => $act_number) {
        $act_date = $act_date * 1000;
        $act_disp .= "[" . number_format($act_date, 0, '.', '') . ", " . $act_number . "],";
    }
    $act_disp = rtrim($act_disp, ",");
    echo $act_disp;
    ?>
                    ];
                  $.plot($("#act_cat_graphs"), [
                    {
                        data: d1,
                        label: "<?php 
    echo $act_tab_types[$act_filter];
    ?>
",
                        bars: { show: true, barWidth : 24*60*60*1000, align: 'center' },
                        color: "#a3bcd3"
                    }
                  ],
                    {
                        xaxis: {
                            mode: "time",
                            minTickSize: [1, "day"],
                            timeformat: "<?php 
    echo $act_df_xaxis;
    ?>
",
                            tickLength: 0,
                            min: xmin,
                            max: xmax,
                            monthNames: <?php 
    echo '["' . short_date_translation(1) . '","' . short_date_translation('Fev') . '","' . short_date_translation('Mar') . '","' . short_date_translation('Apr') . '","' . short_date_translation('May') . '","' . short_date_translation('Jun') . '","' . short_date_translation('Jul') . '","' . short_date_translation('Aug') . '","' . short_date_translation('Sep') . '","' . short_date_translation('Oct') . '","' . short_date_translation('Nov') . '","' . short_date_translation('Dec') . '"]';
    ?>
                        },
                        yaxis: { 
                            tickDecimals: 0,
                            min: 0
                        },
                        grid: {
                            backgroundColor: { colors: ["#fff", "#eee"] },
                            hoverable: true
                        },
                        legend: {
                            show: false
                        }
                    }
                  );
                  function showTooltip(x, y, contents) {
                      $('<div id="tooltip">' + contents + '</div>').css( {
                          position: 'absolute',
                          display: 'none',
                          top: y + 5,
                          left: x + 5,
                          border: '1px solid #ccc',
                          padding: '2px',
                          'background-color': '#fff',
                          opacity: 0.80
                      }).appendTo("body").fadeIn(200);
                  }
              
                  var previousPoint = null;
                  $("#act_cat_graphs").bind("plothover", function (event, pos, item) {
                      $("#x").text(pos.x.toFixed(2));
                      $("#y").text(pos.y.toFixed(2));
                          if (item) {
                              if (previousPoint != item.dataIndex) {
                                  previousPoint = item.dataIndex;
                                  
                                  $("#tooltip").remove();
                                  var x = item.datapoint[0].toFixed(2),
                                      y = item.datapoint[1].toFixed(2);
                                  var actDate = new Date();
                                  actDate.setTime(x);
                                  showTooltip(item.pageX, item.pageY, actDate.toLocaleDateString() + "<br />" + item.series.label + " : " + parseFloat(y));
                              }
                          }
                          else {
                              $("#tooltip").remove();
                              previousPoint = null;            
                          }
                  });
                });
              </script>
            </div>
            <div class="versions"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php 
}
예제 #30
0
mysql_connect("twityitme.db.4326162.hostedresource.com","twityitme","Rhe10za");
mysql_select_db("twityitme");



print "<div class=\"banner_bg\">";
print "&nbsp&nbsp History";
print "</div>";

$query= mysql_query("select HistoryID, first_answer, second_answer, category, date, link_address  from HistoryInfo order by HistoryID DESC");

while( $row=mysql_fetch_assoc( $query) ) {

$first = $row['first_answer'];
$second = $row['second_answer'];
$category = $row['category'];
$date = $row['date'];
$link = $row['link_address'];
$result = nicetime($date);

print "<div class=\"result_bg\"><br /> &nbsp $result,   $first - $second - $category - <a class=\"link1\" href=\"$link\">View This</a> </div> ";
print "</div>";
}


print "<br /><br />";


print "</center></body></html>";

?>