예제 #1
0
파일: AJAX.php 프로젝트: h3rb/page
 public function FormPost()
 {
     $out = array();
     $out["map"] = array();
     foreach (getpost() as $name => $value) {
         if (matches($name, "map")) {
             $map = json_decode(FormHelper::Decode($value));
             foreach ($map as $mapped) {
                 $parts = explode('|', $mapped);
                 if (contains($parts[0], '__')) {
                     $d = explode('__', $parts[0]);
                     if (!isset($out["map"][$d[0]])) {
                         $out["map"][$d[0]] = array();
                     }
                     $out["map"][$d[0]][$d[1]] = AJAX::fp($parts[1]);
                 } else {
                     $mapped[$parts[0]] = AJAX::fp($parts[1]);
                 }
             }
         } else {
             if (contains($name, '__')) {
                 $d = explode("__", $name);
                 if (!isset($out[$d[0]])) {
                     $out[$d[0]] = array();
                 }
                 $out[$d[0]][$d[1]] = base64_decode(urldecode($value));
             } else {
                 $out[$name] = FormHelper::Decode($value);
             }
         }
     }
     $out['signal'] = json_decode($out['signal'], true);
     return $out;
 }
예제 #2
0
function getpostdate($dname)
{
    $minute = getpost($dname . '_minute') ? zeroleftpad((int) getpost($dname . '_minute'), 2) : '00';
    $hour = getpost($dname . '_hour') ? zeroleftpad((int) getpost($dname . '_hour'), 2) : '12';
    $day = getpost($dname . '_day') ? zeroleftpad((int) getpost($dname . '_day'), 2) : 1;
    $month = getpost($dname . '_month') ? zeroleftpad((int) getpost($dname . '_month'), 2) : 1;
    $year = getpost($dname . '_year') ? (int) getpost($dname . '_year') : date("Y");
    return "{$year}-{$month}-{$day} {$hour}:{$minute}";
}
예제 #3
0
         if (!$login[id]) {
             $login[user_name] = "Gast";
             $notifybox = " disabled";
         }
         $fail = $fail_thread;
         $actionsave = "save_thread";
         $schecked = " checked";
         $th_title = "Neues Thema";
         $user_name = mkuser("user_name", 0, $login);
         $smilies = getsmiliesbit("forum.smilies.bit");
         eval("\$incf[action] = \"" . gettemplate("forum.new.post") . "\";");
     }
 }
 ##########################
 if ($action == "editpost" || $fail_edit) {
     $post = getpost($postid);
     if ($post[aut_id] != $login[id] && !is_allowed($sec[forum][id], $boardid)) {
         eval("\$incf[action] = \"" . gettemplate("fail.access.noaccess") . "\";");
     } else {
         $notifybox = list($a) = $db->query("SELECT id FROM {$tab['forum_notify']} WHERE userid='{$post['aut_id']}' AND threadid='{$threadid}'") ? " checked" : " unchecked";
         if ($post[smilies]) {
             $schecked = " checked";
         }
         $fail = $fail_edit;
         $actionsave = "save_edit_thread";
         $th_title = "Post bearbeiten";
         $user_name = mkuser("user_name", $post[aut_id], $NULL);
         $form[title] = $post[post_title];
         $form[text] = $post[post_text];
         $smilies = getsmiliesbit("forum.smilies.bit");
         eval("\$incf[action] = \"" . gettemplate("forum.new.post") . "\";");
예제 #4
0
파일: ajax_form.php 프로젝트: h3rb/page
<?php

include 'core/Page.php';
echo 'woot! ';
var_dump(getpost());
foreach (getpost() as $name => $value) {
    echo '<hr>' . $name . '<br>' . urldecode(base64_decode($value));
}
예제 #5
0
    public function check($access, $cache = false, $validate_sign = false, $disable_counter = false)
    {
        global $cfg;
        if ($cache == false && headers_sent() == false) {
            header('Expires: Mon, 9 Oct 2000 18:00:00 GMT');
            header('Cache-Control: no-store, no-cache, must-revalidate');
        }
        $sid = $this->app->getCookie('netjukebox_sid');
        $authenticate = $this->app->request->params('authenticate');
        $result = $this->app->db->query('
			SELECT logged_in, user_id, idle_time,
			    ip, user_agent, sign, seed, skin,
				random_blacklist, thumbnail, thumbnail_size,
				stream_id, download_id, player_id
			FROM session
			WHERE sid = BINARY "' . $this->app->db->real_escape_string($sid) . '"');
        $session = $result->fetch_assoc();
        //setSkin($session['skin']);
        // Validate login
        if ($authenticate == 'validate') {
            $username = $this->app->request->post('username');
            $hash1 = $this->app->request->post('hash1');
            $hash2 = $this->app->request->post('hash2');
            $sign = $this->app->request->post('sign');
            if ($session['ip'] == '') {
                message(__FILE__, __LINE__, 'error', '[b]Login failed[/b][br]netjukebox requires cookies to login.[br]Enable cookies in your browser and try again.[br][url=index.php][img]small_login.png[/img]login[/url]');
            }
            if ($session['ip'] != $_SERVER['REMOTE_ADDR']) {
                message(__FILE__, __LINE__, 'error', '[b]Login failed[/b][br]Unexpected IP address[br][url=index.php][img]small_login.png[/img]login[/url]');
            }
            $query = mysql_query('SELECT ' . (string) round(microtime(true) * 1000) . ' - pre_login_time AS login_delay FROM session WHERE ip = "' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '" ORDER BY pre_login_time DESC LIMIT 1');
            $ip = mysql_fetch_assoc($query);
            $query = mysql_query('SELECT password, seed, version, user_id FROM user WHERE username = "******"');
            $user = mysql_fetch_assoc($query);
            $user_id = $user['user_id'];
            if (($user['version'] == 0 && $user['password'] == sha1($hash1) || $user['version'] == 1 && $user['password'] == hmacsha1($hash1, $user['seed'])) && preg_match('#^[0-9a-f]{40}$#', $hash1) && preg_match('#^[0-9a-f]{40}$#', $hash2) && ($username == $cfg['anonymous_user'] && $hash2 == hmacsha1(hmacsha1($cfg['anonymous_user'], $session['seed']), $session['seed']) || $username != $cfg['anonymous_user'] && $hash2 != hmacsha1(hmacsha1('', $session['seed']), $session['seed'])) && $ip['login_delay'] > $cfg['login_delay'] && $session['user_agent'] == substr($_SERVER['HTTP_USER_AGENT'], 0, 255) && $session['sign'] == $sign) {
                mysql_query('UPDATE user SET
					password		= "******",
					seed			= "' . mysql_real_escape_string($session['seed']) . '",
					version			= 1
					WHERE username	= "******"');
                $sign = randomKey();
                $sid = randomKey();
                mysql_query('UPDATE session SET
					logged_in		= 1,
					user_id			= ' . (int) $user_id . ',
					login_time		= ' . (int) time() . ',
					idle_time		= ' . (int) time() . ',
					sid				= "' . mysql_real_escape_string($sid) . '",
					sign			= "' . mysql_real_escape_string($sign) . '",
					hit_counter		= hit_counter + ' . ($disable_counter ? 0 : 1) . ',
					visit_counter	= visit_counter + ' . (time() > $session['idle_time'] + 3600 ? 1 : 0) . '
					WHERE sid		= BINARY "' . mysql_real_escape_string(cookie('netjukebox_sid')) . '"');
                setcookie('netjukebox_sid', $sid, time() + 31536000, null, null, NJB_HTTPS, true);
                @ob_flush();
                flush();
            } else {
                logoutSession();
            }
        } else {
            // Validate current session
            $user_id = $session['user_id'];
            if ($session['logged_in'] && $session['ip'] == $_SERVER['REMOTE_ADDR'] && $session['user_agent'] == substr($_SERVER['HTTP_USER_AGENT'], 0, 255) && $session['idle_time'] + $cfg['session_lifetime'] > time()) {
                mysql_query('UPDATE session SET
					idle_time		= ' . (int) time() . ',
					hit_counter		= hit_counter + ' . ($disable_counter ? 0 : 1) . ',
					visit_counter	= visit_counter + ' . (time() > $session['idle_time'] + 3600 ? 1 : 0) . '
					WHERE sid		= BINARY "' . mysql_real_escape_string($sid) . '"');
            } elseif ($access == 'access_always') {
                $cfg['access_media'] = false;
                $cfg['access_popular'] = false;
                $cfg['access_favorite'] = false;
                $cfg['access_cover'] = false;
                $cfg['access_stream'] = false;
                $cfg['access_download'] = false;
                $cfg['access_playlist'] = false;
                $cfg['access_play'] = false;
                $cfg['access_add'] = false;
                $cfg['access_record'] = false;
                $cfg['access_statistics'] = false;
                $cfg['access_admin'] = false;
                return true;
            } else {
                $app->ll->str('böla');
                logoutSession();
            }
        }
        // Username & user privalages
        unset($cfg['username']);
        $query = mysql_query('SELECT
			username,
			access_media,
			access_popular,
			access_favorite,
			access_cover,
			access_stream,
			access_download,
			access_playlist,
			access_play,
			access_add,
			access_record,
			access_statistics,
			access_admin
			FROM user
			WHERE user_id = ' . (int) $user_id);
        $cfg += mysql_fetch_assoc($query);
        // Validate privilege
        $access_validated = false;
        if (is_array($access)) {
            foreach ($access as $value) {
                if (isset($cfg[$value]) && $cfg[$value]) {
                    $access_validated = true;
                }
            }
        } elseif (isset($cfg[$access]) && $cfg[$access]) {
            $access_validated = true;
        } elseif ($access == 'access_logged_in') {
            $access_validated = true;
        } elseif ($access == 'access_always') {
            $access_validated = true;
        }
        if ($access_validated == false) {
            message(__FILE__, __LINE__, 'warning', '[b]You have no privilege to access this page[/b][br][url=index.php?authenticate=logout][img]small_login.png[/img]Login as another user[/url]');
        }
        // Validate signature
        if ($cfg['sign_validated'] == false && ($validate_sign || $authenticate == 'logoutAllSessions' || $authenticate == 'logoutSession')) {
            $cfg['sign'] = randomKey();
            mysql_query('UPDATE session
				SET	sign		= "' . mysql_real_escape_string($cfg['sign']) . '"
				WHERE sid		= BINARY "' . mysql_real_escape_string($sid) . '"');
            if ($session['sign'] == getpost('sign')) {
                $cfg['sign_validated'] = true;
            } else {
                message(__FILE__, __LINE__, 'error', '[b]Signature expired[/b]');
            }
        } else {
            $cfg['sign'] = $session['sign'];
        }
        // Logout
        if ($authenticate == 'logout' && $cfg['username'] != $cfg['anonymous_user']) {
            $query = mysql_query('SELECT user_id FROM session
				WHERE logged_in
				AND user_id		= ' . (int) $user_id . '
				AND idle_time	> ' . (int) (time() - $cfg['session_lifetime']));
            if (mysql_affected_rows($db) > 1) {
                logoutMenu();
            } else {
                logoutSession();
            }
        } elseif ($authenticate == 'logoutAllSessions' && $cfg['username'] != $cfg['anonymous_user']) {
            mysql_query('UPDATE session
				SET logged_in	= 0
				WHERE user_id	= ' . (int) $user_id);
            logoutSession();
        } elseif ($authenticate == 'logoutSession' || $authenticate == 'logout') {
            logoutSession();
        }
        $cfg['user_id'] = $user_id;
        $cfg['sid'] = $sid;
        $cfg['session_seed'] = $session['seed'];
        $cfg['random_blacklist'] = $session['random_blacklist'];
        //$cfg['thumbnail']			= $session['thumbnail'];
        $cfg['thumbnail'] = 1;
        //$cfg['thumbnail_size']		= $session['thumbnail_size'];
        $cfg['thumbnail_size'] = 100;
        $cfg['stream_id'] = isset($cfg['encode_extension'][$session['stream_id']]) ? $session['stream_id'] : -1;
        $cfg['download_id'] = isset($cfg['encode_extension'][$session['download_id']]) ? $session['download_id'] : -1;
        $cfg['player_id'] = $session['player_id'];
    }
예제 #6
0
function display_post($userdata, $datetype, $postdate, $cmds, $posttext)
{
    global $powerlevels;
    $author = userlink_big($userdata[userid], htmlspecialchars($userdata[username]), $userdata[powerlevel]);
    $postdate = parsedate($postdate);
    $joindate = parsedate_short($userdata[joindate]);
    $sig = '';
    if ($userdata['signature'] != '') {
        $sig = '<hr>';
        $sig .= getpost($userdata['signature'], true, true, false);
    }
    $avatar = '';
    if ($userdata['hasavatar'] == 1) {
        $avatar = "<img src='avatars/{$userdata['userid']}.{$userdata['avatarext']}' alt='Avatar'><br>";
    }
    $utitle = htmlspecialchars($userdata[usertitle]);
    print "<table class='post' width='100%'>";
    print "<tr>";
    print "<td rowspan='2' valign='top' class='postsidebar'>";
    print "<b>{$author}</b>";
    if ($utitle) {
        print "<div class='smallspacing'></div>{$utitle}";
    }
    if ($avatar) {
        print "<div class='bigspacing'></div>";
        print "{$avatar}";
    }
    print "<div class='bigspacing'></div>";
    print "<span class='label'>Posts:</span> {$userdata['posts']}<br>";
    print "<span class='label'>Joined:</span> {$joindate}<br>";
    if ($userdata[powerlevel] > 5) {
        print "<span class='label'>Rank:</span> {$powerlevels[$userdata[powerlevel]]}<br>";
    }
    $replink = replink($userdata[userid], $userdata[reputation]);
    print "<span class='label'>Reputation:</span> {$replink}<br>";
    // custom postbit fields go here
    print "</td>";
    print "<td class='postdate' height='1'>{$datetype} {$postdate}{$cmds}</td>";
    print "</tr>";
    print "<tr><td valign='top' class='postcontent'>{$posttext}{$sig}</td></tr>";
    print "</table>";
}
예제 #7
0
            dol_syslog("gestimmo::site::card error=" . $agf->error, LOG_ERR);
            $mesg = '<div class="error">' . $agf->error . '</div>';
        }
    }
}
/*
 * Action create (fiche bien immo)
*/
if ($action == 'create_confirm') {
    if (!$_POST["cancel"]) {
        $agf = new Mandat($db);
        $agf->ref_interne = GETPOST('ref', 'alpha');
        $agf->fk_soc = "1";
        $agf->fk_biens = "0";
        $agf->descriptif = GETPOST('descriptif', 'alpha');
        $agf->entity = getpost('entity');
        $agf->datec = $now;
        $agf->date_contrat = $now;
        $agf->date_creation = $now;
        $agf->date_cloture = $now;
        $agf->status = "1";
        $agf->mise_en_service = $now;
        $agf->fin_validite = $now;
        $agf->fk_bails = '0';
        $agf->fk_commercial = '1';
        $agf->fk_user_author = $user;
        $agf->fk_user_mod = '1';
        $agf->fk_user_author = '1';
        $result = $agf->create($user);
        if ($result > 0) {
            if ($url_return) {
예제 #8
0
function tohtml($id)
{
    $tmstart = rticktime();
    $x = getpost($id);
    $tmtime = number_format(rticktime() - $tmstart, 3);
    $starttime = rticktime();
    header("HTTP/1.0 200 Ok");
    $y = json_decode($x);
    // -- make groups list
    $ga = $y->subscribers;
    $ga_cnt = sizeof($ga);
    $ga_out = array();
    for ($i = 0; $i < $ga_cnt; $i++) {
        if ($ga[$i]->type == "group") {
            $ga_out[$ga[$i]->id] = $ga[$i]->username;
        }
    }
    $groups = array();
    foreach ($y->subscriptions as $g) {
        if (isset($ga_out[$g->user])) {
            $groups[$g->id] = $ga_out[$g->user];
        }
    }
    // end make groups list
    //body
    if (!isset($y->posts->body)) {
        print "html warn: " . htmlspecialchars($id) . "\n";
    }
    $text = $y->posts->body;
    //preg_match('/^(.*){1,10}/U',$text,$result1)
    mb_internal_encoding("UTF-8");
    $title = mb_substr($text, 0, 50);
    //time
    $time = $y->posts->createdAt;
    $time_html = htmlspecialchars(date("d.m.y H:i", ($time + 0) / 1000)) . "\n";
    // check groups
    //   $ghtml="<b>";
    $ghtml = "";
    $ps_cnt = sizeof($y->posts->postedTo);
    if ($ps_cnt > 1) {
        $ghtml .= "+";
    }
    for ($j = 0; $j < $ps_cnt; $j++) {
        $xz = $y->posts->postedTo[$j];
        if (isset($groups[$xz])) {
            $ghtml .= htmlspecialchars($groups[$xz]) . ":";
        }
    }
    //   $ghtml.="</b>";
    // users
    $usersarr = $y->users;
    $userasize = sizeof($usersarr);
    $users = array();
    $usracs = array();
    if ($userasize != 0) {
        for ($i = 0; $i < $userasize; $i++) {
            $users[$usersarr[$i]->id] = $usersarr[$i]->username;
            $usracs[$usersarr[$i]->id] = $usersarr[$i]->isPrivate;
        }
    }
    //author
    $auser = $y->posts->createdBy;
    $mmname = $users[$auser];
    $auname = "<b>" . htmlspecialchars($ghtml) . htmlspecialchars($mmname) . "</b>";
    $time_html = $auname . ' / ' . $time_html;
    //likes
    $likes_html = '';
    if (isset($y->posts->likes)) {
        $likesarr = $y->posts->likes;
    } else {
        $likesarr = array();
    }
    $likesasize = sizeof($likesarr);
    if ($likesasize != 0) {
        for ($i = 0; $i < $likesasize; $i++) {
            $likes_html .= htmlspecialchars($users[$likesarr[$i]]) . ", ";
        }
        $likes_html = "<p>Likes: " . $likes_html . "</p>\n";
    }
    //attach
    $attach_html = '';
    if (isset($y->attachments)) {
        $attacharr = $y->attachments;
    } else {
        $attacharr = array();
    }
    $attachasize = sizeof($attacharr);
    if ($attachasize != 0) {
        for ($i = 0; $i < $attachasize; $i++) {
            if ($attacharr[$i]->mediaType != "image") {
                $attach_html .= "<a href=\"" . htmlspecialchars($attacharr[$i]->url) . "\">" . htmlspecialchars($attacharr[$i]->fileName) . "</a><br>\n";
            } else {
                $attach_html .= "<img src=\"" . htmlspecialchars($attacharr[$i]->thumbnailUrl) . "\"><br>\n";
            }
        }
    }
    //comments
    if (isset($y->posts->comments)) {
        $commntarr = $y->posts->comments;
    } else {
        $commntarr = array();
    }
    $commasize = sizeof($commntarr);
    $comm_html = '';
    if ($commasize != 0) {
        $comm_html .= '<ul>';
        for ($i = 0; $i < $commasize; $i++) {
            $zbody = htmlspecialchars($y->comments[$i]->body);
            $zuser = $y->comments[$i]->createdBy;
            $comm_html .= "<li>" . $zbody . " - <i>" . htmlspecialchars($users[$zuser]) . "</i>\n";
        }
        $comm_html .= '</ul>';
    }
    $gentime = number_format(rticktime() - $starttime, 3);
    $origin = "<a href=\"https://freefeed.net/" . htmlspecialchars($mmname . "/" . $id) . "\">Original record</a>";
    $hhead = "<!DOCTYPE html><html><head><title>frf: " . htmlspecialchars($title) . " (" . htmlspecialchars($id) . ")</title></head><body bgcolor=\"#FFFFFF\">";
    $htail = "<p>\n" . htmlspecialchars($tmtime . "/" . $gentime) . "</body></html>";
    $hout = "<p>" . htmlspecialchars($text) . "<br>{$time_html}</p><p>{$attach_html}</p>{$likes_html}<p>{$comm_html}</p><p>{$origin}</p>";
    //   print $hout;
    return $hhead . $hout . $htail;
}
예제 #9
0
파일: Auth.php 프로젝트: h3rb/page
$auth = NULL;
global $session;
$session = NULL;
global $user;
$user = NULL;
global $domain;
$domain = NULL;
global $expired;
$expired = false;
global $pageurl;
$pageurl = current_page_url();
global $is_logged_in;
$is_logged_in = false;
if (!defined('quiet_auth')) {
    $domain = explode("/", str_replace("http://", "", $pageurl));
    $domain = $domain[0];
}
if (!defined('suppress_auth')) {
    $session_model->Active();
    plog('$auth: ' . vars($auth));
    plog('$session: ' . vars($session));
}
global $plog_level;
if ($plog_level == 1) {
    plog('##### $pageurl: ' . vars($pageurl));
    if (isset($_SERVER['HTTP_REFERRER'])) {
        plog('Referred: ' . $_SERVER['HTTP_REFERRER']);
    }
    plog('getpost():------' . vars(getpost()));
}
plog('----Executing: ' . vars($pageurl));
예제 #10
0
function imageUpdate($flag)
{
    global $cfg, $db;
    authenticate('access_admin');
    $size = get('size');
    $artistSearch = post('artist');
    $albumSearch = post('album');
    $image_service_id = (int) post('image_service_id');
    if (in_array($size, array('50', '100', '200'))) {
        mysql_query('UPDATE session
			SET thumbnail_size	= ' . (int) $size . '
			WHERE sid			= BINARY "' . mysql_real_escape_string($cfg['sid']) . '"');
    } else {
        $size = $cfg['thumbnail_size'];
    }
    if (isset($cfg['image_service_name'][$image_service_id]) == false) {
        message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]image_service_id');
    }
    // flag 0 = No image
    // flag 1 = Skipped
    // flag 2 = Skipped not updated in this run
    // flag 3 = Stored image
    // flag 9 = Update one image by album_id, Needed for redirect to saveImage() (store as flag 1 or 3 in database)
    if ($flag == 2) {
        mysql_query('UPDATE bitmap SET flag = 2 WHERE flag = 1');
        $flag = 1;
    }
    if ($flag == 1) {
        $query = mysql_query('SELECT album.artist, album.album, album.album_id
			FROM album, bitmap
			WHERE bitmap.flag = 2
			AND bitmap.album_id = album.album_id
			ORDER BY album.artist_alphabetic, album.album');
    } elseif ($flag == 0) {
        $query = mysql_query('SELECT album.artist, album.album, album.album_id
			FROM album, bitmap
			WHERE bitmap.flag = 0
			AND bitmap.album_id = album.album_id
			ORDER BY album.artist_alphabetic, album.album');
    } elseif ($flag == 9 && $cfg['album_update_image']) {
        $album_id = getpost('album_id');
        $query = mysql_query('SELECT album.artist, album.artist_alphabetic, album.album, album.image_id, album.album_id,
			bitmap.flag, bitmap.image_front_width, bitmap.image_front_height
			FROM album, bitmap
			WHERE album.album_id = "' . mysql_real_escape_string($album_id) . '"
			AND bitmap.album_id = album.album_id');
    } else {
        message(__FILE__, __LINE__, 'error', '[b]Error internet image update[/b][br]Unsupported flag set');
    }
    $album = mysql_fetch_assoc($query);
    if ($album == '') {
        header('Location: ' . NJB_HOME_URL . 'config.php');
        exit;
    }
    if ($artistSearch == '' && $albumSearch == '') {
        // Remove (...) [...] {...} from the end
        $artistSearch = preg_replace('#^(.+?)(?:\\s*\\(.+\\)|\\s*\\[.+\\]|\\s*{.+})?$#', '$1', $album['artist']);
        $albumSearch = preg_replace('#^(.+?)(?:\\s*\\(.+\\)|\\s*\\[.+\\]|\\s*{.+})?$#', '$1', $album['album']);
    }
    $responce_url = array();
    $responce_pixels = array();
    $responce_resolution = array();
    $responce_squire = array();
    $url = $cfg['image_service_url'][$image_service_id];
    $url = str_replace('%artist', rawurlencode(iconv(NJB_DEFAULT_CHARSET, $cfg['image_service_charset'][$image_service_id], $artistSearch)), $url);
    $url = str_replace('%album', rawurlencode(iconv(NJB_DEFAULT_CHARSET, $cfg['image_service_charset'][$image_service_id], $albumSearch)), $url);
    if ($cfg['image_service_process'][$image_service_id] == 'amazon') {
        // Amazon web services
        if (function_exists('hash_hmac') == false) {
            message(__FILE__, __LINE__, 'error', '[b]Missing hash_hmac function[/b][br]For the Amazone Web Service the hash_hmac function is required.');
        }
        $url = str_replace('%awsaccesskeyid', rawurlencode($cfg['image_AWSAccessKeyId']), $url);
        $url = str_replace('%associatetag', rawurlencode($cfg['image_AWSAssociateTag']), $url);
        $url = str_replace('%timestamp', rawurlencode(gmdate('Y-m-d\\TH:i:s\\Z')), $url);
        $url_array = parse_url($url);
        // Sort on query key
        $query = $url_array['query'];
        $query = explode('&', $query);
        sort($query);
        $query = implode('&', $query);
        $signature = 'GET' . "\n";
        $signature .= $url_array['host'] . "\n";
        $signature .= $url_array['path'] . "\n";
        $signature .= $query;
        $signature = rawurlencode(base64_encode(hash_hmac('sha256', $signature, $cfg['image_AWSSecretAccessKey'], true)));
        // $url = $url_array['scheme'] . '://' . $url_array['host'] . $url_array['path'] . '?' . $query;
        $url .= '&Signature=' . $signature;
        $xml = @simplexml_load_file($url) or message(__FILE__, __LINE__, 'error', '[b]Failed to open XML file:[/b][br]' . $url);
        foreach ($xml->Items->Item as $item) {
            if (@$item->LargeImage->URL && @$item->LargeImage->Width && @$item->LargeImage->Height) {
                $responce_url[] = $item->LargeImage->URL;
                $responce_pixels[] = $item->LargeImage->Width * $item->LargeImage->Height;
                $responce_resolution[] = $item->LargeImage->Width . ' x ' . $item->LargeImage->Height;
                $responce_squire[] = $item->LargeImage->Width / $item->LargeImage->Height > 0.95 && $item->LargeImage->Width / $item->LargeImage->Height < 1.05 ? true : false;
            }
        }
    } elseif ($cfg['image_service_process'][$image_service_id] == 'lastfm') {
        // Last.fm web services
        $url = str_replace('%api_key', rawurlencode($cfg['image_lastfm_api_key']), $url);
        $xml = @simplexml_load_file($url) or message(__FILE__, __LINE__, 'error', '[b]Failed to open XML file:[/b][br]' . $url);
        foreach ($xml->album->image as $image) {
            $imagesize = @getimagesize($image);
            $width = $imagesize[0];
            $height = $imagesize[1];
            $responce_url[] = $image;
            $responce_pixels[] = $width * $height;
            $responce_resolution[] = $width . 'x' . $height;
            $responce_squire[] = $width / $height > 0.95 && $width / $height < 1.05 ? true : false;
        }
    } else {
        // Regular expression
        $content = @file_get_contents($url) or message(__FILE__, __LINE__, 'error', '[b]Failed to open url:[/b][br]' . $url);
        if (preg_match_all($cfg['image_service_process'][$image_service_id], $content, $match)) {
            foreach ($match[1] as $key => $image) {
                if ($cfg['image_service_urldecode'][$image_service_id]) {
                    $image = rawurldecode($image);
                }
                $extension = substr(strrchr($image, '.'), 1);
                $extension = strtolower($extension);
                if (!in_array($extension, array('gif', 'bmp'))) {
                    if (isset($match[2][$key]) && isset($match[3][$key])) {
                        $width = $match[2][$key];
                        $height = $match[3][$key];
                    } else {
                        $imagesize = @getimagesize($image);
                        $width = $imagesize[0];
                        $height = $imagesize[1];
                    }
                    $responce_url[] = $image;
                    $responce_pixels[] = $width * $height;
                    $responce_resolution[] = $width . 'x' . $height;
                    $responce_squire[] = $width / $height > 0.95 && $width / $height < 1.05 ? true : false;
                }
            }
        }
    }
    // squire images first:
    array_multisort($responce_squire, SORT_DESC, $responce_pixels, SORT_DESC, $responce_url, $responce_resolution);
    $colombs = floor((cookie('netjukebox_width') - 20) / ($size + 10));
    $max_images = count($responce_squire) + 2;
    // n + "no image available" + "upload"
    if (isset($album['flag']) && $album['flag'] == 3) {
        $max_images += 1;
    }
    // Current image
    if ($flag == 9) {
        $cfg['menu'] = 'media';
        // formattedNavigator
        $nav = array();
        $nav['name'][] = 'Media';
        $nav['url'][] = 'index.php';
        $nav['name'][] = $album['artist_alphabetic'];
        $nav['url'][] = 'index.php?action=view2&amp;artist=' . rawurlencode($album['artist_alphabetic']);
        $nav['name'][] = $album['album'];
        $nav['url'][] = 'index.php?action=view3&amp;album_id=' . rawurlencode($album_id);
        $nav['name'][] = 'Update image';
    } else {
        // formattedNavigator
        $nav = array();
        $nav['name'][] = 'Configuration';
        $nav['url'][] = 'config.php';
        $nav['name'][] = 'Update image';
    }
    require_once 'include/header.inc.php';
    ?>
<form action="update.php" method="post">
		<input type="hidden" name="action" value="imageUpdate">
		<input type="hidden" name="flag" value="<?php 
    echo $flag;
    ?>
">
		<input type="hidden" name="album_id" value="<?php 
    if (isset($album_id)) {
        echo $album_id;
    }
    ?>
">
<table cellspacing="0" cellpadding="0" class="border">
<tr class="header">
	<td colspan="<?php 
    echo $colombs + 2;
    ?>
">
	<!-- begin table header -->
	<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="header">
		<td class="space"></td>
		<td><?php 
    echo html($album['artist']) . ' - ' . html($album['album']);
    ?>
</td>
		<td align="right">
			<!-- Brake image tag to prevent space -->
			<a href="update.php?action=imageUpdate<?php 
    if (isset($album_id)) {
        echo '&amp;album_id=' . $album_id;
    }
    ?>
&amp;flag=<?php 
    echo $flag;
    ?>
&amp;size=50"><img src="<?php 
    echo $cfg['img'];
    ?>
small_header_image50_<?php 
    echo $size == '50' ? 'on' : 'off';
    ?>
.png" alt="" class="small align"></a><a href="update.php?action=imageUpdate<?php 
    if (isset($album_id)) {
        echo '&amp;album_id=' . $album_id;
    }
    ?>
&amp;flag=<?php 
    echo $flag;
    ?>
&amp;size=100"><img src="<?php 
    echo $cfg['img'];
    ?>
small_header_image100_<?php 
    echo $size == '100' ? 'on' : 'off';
    ?>
.png" alt="" class="small align"></a><a href="update.php?action=imageUpdate<?php 
    if (isset($album_id)) {
        echo '&amp;album_id=' . $album_id;
    }
    ?>
&amp;flag=<?php 
    echo $flag;
    ?>
&amp;size=200"><img src="<?php 
    echo $cfg['img'];
    ?>
small_header_image200_<?php 
    echo $size == '200' ? 'on' : 'off';
    ?>
.png" alt="" class="small align"></a>
		</td>
	</tr>
	</table>
	<!-- end table header -->
	</td>
</tr>
<tr class="line"><td colspan="<?php 
    echo $colombs + 2;
    ?>
"></td></tr>
<tr class="odd smallspace"><td colspan="<?php 
    echo $colombs + 2;
    ?>
"></td></tr>
<?php 
    for ($i = 0; $i < ceil($max_images / $colombs); $i++) {
        $class = $i & 1 ? 'even' : 'odd';
        ?>
<tr class="<?php 
        echo $class;
        ?>
">
	<td class="smallspace">&nbsp;</td>
<?php 
        for ($j = 1; $j <= $colombs; $j++) {
            ?>
	<td width="<?php 
            echo $size + 10;
            ?>
" height="<?php 
            echo $size + 10;
            ?>
" align="center">
	<span id="image<?php 
            echo $i * $colombs + $j;
            ?>
"><img src="image/transparent.gif" alt="" width="<?php 
            echo $size;
            ?>
" height="<?php 
            echo $size;
            ?>
" class="align"></span>
	</td>
<?php 
        }
        ?>
	<td class="smallspace">&nbsp;</td>
</tr>
<?php 
    }
    ?>
<tr class="<?php 
    echo $class;
    ?>
 smallspace"><td colspan="<?php 
    echo $colombs + 2;
    ?>
"></td></tr>
<tr class="line"><td colspan="<?php 
    echo $colombs + 2;
    ?>
"></td></tr>
<tr class="footer">
	<td colspan="<?php 
    echo $colombs + 2;
    ?>
">
	<!-- begin table footer -->
	<table cellspacing="0" cellpadding="0">
	<tr class="footer smallspace"><td colspan="6"></td></tr>
	<tr class="footer">
		<td class="space"></td>
		<td>Artist:</td>
		<td class="space"></td>
		<td><input type="text" name="artist" value="<?php 
    echo html($artistSearch);
    ?>
" class="edit"></td>
		<td class="textspace"></td>
		<td>		
		<select name="image_service_id">
<?php 
    foreach ($cfg['image_service_name'] as $key => $value) {
        echo "\t\t" . '<option value="' . $key . '"' . ($image_service_id == $key ? ' selected' : '') . '>' . html($value) . '</option>' . "\n";
    }
    ?>
		</select>		
		</td>
	</tr>
	<tr class="footer smallspace"><td colspan="6"></td></tr>
	<tr class="footer">
		<td></td>		
		<td>Album:</td>
		<td></td>
		<td><input type="text" name="album" value="<?php 
    echo html($albumSearch);
    ?>
" class="edit"></td>
		<td></td>
		<td><input type="image" src="<?php 
    echo $cfg['img'];
    ?>
button_small_search.png"></td>
	</tr>
	<tr class="footer smallspace">
		<td colspan="10"></td>
	</tr>
	</table>
	<!-- end table footer -->
	</td>
</tr>
</table>
</form>
<?php 
    $cfg['footer'] = 'dynamic';
    require 'include/footer.inc.php';
    $i = 0;
    if (isset($album['flag']) && $album['flag'] == 3) {
        // Show current image
        $i++;
        $mouseover = ' onMouseOver="return overlib(\\\'' . $album['image_front_width'] . ' x ' . $album['image_front_height'] . '\\\', CAPTION, \\\'Current image:&nbsp;\\\');" onMouseOut="return nd();"';
        $url = '<a href="index.php?action=view3&amp;album_id=' . rawurlencode($album_id) . '"' . $mouseover . '><img src="image.php?image_id=' . $album['image_id'] . '" alt="" width="' . $size . '" height="' . $size . '" class="align"><\\/a>';
        echo '<script type="text/javascript">document.getElementById(\'image' . $i . '\').innerHTML=\'' . $url . '\';</script>' . "\n";
    }
    foreach ($responce_url as $key => $image) {
        $i++;
        $mouseover = ' onMouseOver="return overlib(\\\'' . html($responce_resolution[$key]) . '\\\');" onMouseOut="return nd();"';
        $url = '<a href="update.php?action=saveImage&flag=' . $flag . '&amp;album_id=' . $album['album_id'] . '&amp;image=' . rawurlencode($image) . '&amp;sign=' . $cfg['sign'] . '"' . $mouseover . '><img src="image.php?image=' . rawurlencode($image) . '" alt="" width="' . $size . '" height="' . $size . '" class="align"><\\/a>';
        echo '<script type="text/javascript">document.getElementById(\'image' . $i . '\').innerHTML=\'' . $url . '\';</script>' . "\n";
    }
    $i++;
    $mouseover = ' onMouseOver="return overlib(\\\'No image\\\');" onMouseOut="return nd();"';
    $url = '<a href="update.php?action=saveImage&amp;flag=' . $flag . '&amp;album_id=' . $album['album_id'] . '&amp;image=noImage&amp;sign=' . $cfg['sign'] . '"' . $mouseover . '><img src="image/no_image.png" alt="" width="' . $size . '" height="' . $size . '" class="align"><\\/a>';
    echo '<script type="text/javascript">document.getElementById(\'image' . $i . '\').innerHTML=\'' . $url . '\';</script>' . "\n";
    $i++;
    $mouseover = ' onMouseOver="return overlib(\\\'Upload\\\');" onMouseOut="return nd();"';
    $url = '<a href="update.php?action=selectImageUpload&amp;flag=' . $flag . '&amp;album_id=' . $album['album_id'] . '"' . $mouseover . '><img src="skin/' . rawurlencode($cfg['skin']) . '/img/large_upload.png" alt="" width="' . $size . '" height="' . $size . '" class="align"><\\/a>';
    echo '<script type="text/javascript">document.getElementById(\'image' . $i . '\').innerHTML=\'' . $url . '\';</script>' . "\n";
    $cfg['footer'] = 'close';
    require 'include/footer.inc.php';
}
예제 #11
0
function saveFavorite($favorite_id)
{
    global $db;
    authenticate('access_admin', false, true, true);
    $name = getpost('name');
    $comment = getpost('comment');
    mysql_query('UPDATE favorite SET
		name	= "' . mysql_real_escape_string($name) . '",
		comment	= "' . mysql_real_escape_string($comment) . '"
		WHERE favorite_id = ' . (int) $favorite_id);
    home();
}
예제 #12
0
파일: utility.php 프로젝트: h3rb/page
 function page_input($keys)
 {
     if (!is_array($keys)) {
         $keys = func_get_args();
     }
     global $getpost;
     if (!isset($getpost) || !is_array($getpost)) {
         $getpost = getpost();
     }
     plog('page_input:getpost(): ' . vars($getpost));
     plog('page_input:checked against required input parameters ' . vars($keys));
     foreach ($keys as $numbered => $v) {
         if (!isset($getpost[$v])) {
             return FALSE;
         }
     }
     plog('page_input:PASSED');
     return $getpost;
 }
예제 #13
0
파일: users.php 프로젝트: jdeblese/ompd-mod
//  |                                                                        |
//  | This program is distributed in the hope that it will be useful,        |
//  | but WITHOUT ANY WARRANTY; without even the implied warranty of         |
//  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          |
//  | GNU General Public License for more details.                           |
//  |                                                                        |
//  | You should have received a copy of the GNU General Public License      |
//  | along with this program.  If not, see <http://www.gnu.org/licenses/>.  |
//  +------------------------------------------------------------------------+
//  +------------------------------------------------------------------------+
//  | users.php                                                              |
//  +------------------------------------------------------------------------+
require_once 'include/initialize.inc.php';
$cfg['menu'] = 'config';
$action = getpost('action');
$user_id = getpost('user_id');
if ($action == '') {
    home();
} elseif ($action == 'editUser') {
    editUser($user_id);
} elseif ($action == 'updateUser') {
    updateUser($user_id);
    home();
} elseif ($action == 'deleteUser') {
    deleteUser($user_id);
    home();
} elseif ($action == 'online') {
    online();
} elseif ($action == 'resetSessions') {
    resetSessions();
    online();
예제 #14
0
     $gestimmo = new Bails($db);
     // Pour rensegner les valeurs du bails
     $staticmandat = new Mandat($db);
     $idmandat = GETPOST('fk_mandat');
     $staticresult = $staticmandat->fetch($idmandat);
     //  print $staticmandat->id;
     // todo champs pour la creation du bail
     $gestimmo->fk_prop = $staticmandat->fk_soc;
     $gestimmo->fk_loc = GETPOST('fk_loc', 'int');
     $gestimmo->fk_logement = $staticmandat->fk_biens;
     $gestimmo->fk_mandat = GETPOST('fk_mandat', 'int');
     $gestimmo->Type = GETPOST('Type', 'alpha');
     $gestimmo->Date_location = GETPOST('Date_location', 'alpha');
     $gestimmo->Depot_garantie = GETPOST('Depot_garantie', 'alpha');
     $gestimmo->date_fin = GETPOST('date_fin', 'alpha');
     $gestimmo->entity = getpost('entity');
     $result = $gestimmo->create($user);
     if ($result > 0) {
         if ($url_return) {
             Header("Location: " . $url_return);
         } else {
             Header("Location: " . $_SERVER['PHP_SELF'] . "?action=edit&id=" . $result);
         }
         exit;
     } else {
         dol_syslog("gestimmo::bails::card error=" . $gestimmo->error, LOG_ERR);
         $mesg = '<div class="error">' . $gestimmo->error . '</div>';
     }
 } else {
     Header("Location: list.php");
     exit;
예제 #15
0
//  | Head & Body                                                            |
//  +------------------------------------------------------------------------+
$header['title'] = 'O!MPD &bull; ';
if (NJB_SCRIPT == 'message.php') {
    $header['title'] .= 'Message';
} elseif ($cfg['username'] == '') {
    $header['title'] .= 'Live @ ' . html($_SERVER['HTTP_HOST']);
} elseif (NJB_SCRIPT == 'playlist.php') {
    $header['title'] .= 'Now playing';
} elseif (get('authenticate') == 'logout') {
    $header['title'] .= 'Logout';
} elseif (get('authenticate') == 'logoutSession' && get('sign')) {
    $header['title'] .= 'Signed (Logout session)';
} elseif (get('authenticate') == 'logoutAllSessions' && get('sign')) {
    $header['title'] .= 'Signed (Logout all sessions)';
} elseif (getpost('sign')) {
    $header['title'] .= 'Signed (' . html(implode(' - ', $nav['name'])) . ')';
} elseif (empty($nav['name'])) {
    $header['title'] .= 'Undefined';
} else {
    $header['title'] .= html(implode(' - ', $nav['name']));
}
$header['head'] = "\t" . '<meta http-equiv="Content-Type" content="text/html; charset=' . html(NJB_DEFAULT_CHARSET) . '">' . "\n";
$header['head'] .= "\t" . '<meta name="generator" content="netjukebox, Copyright (C) 2001-2012 Willem Bartels; O!MPD, Copyright (C) 2015 Artur Sierzant">' . "\n";
$header['head'] .= "\t" . '<title>' . $header['title'] . '</title>' . "\n";
if (isset($cfg['access_media']) && $cfg['access_media']) {
    $header['head'] .= "\t" . '<link rel="search" type="application/opensearchdescription+xml" title="O!MPD - Album Artist" href="' . NJB_HOME_URL . 'opensearch.php?action=installAlbumArtist">' . "\n";
    $header['head'] .= "\t" . '<link rel="search" type="application/opensearchdescription+xml" title="O!MPD - Track Artist" href="' . NJB_HOME_URL . 'opensearch.php?action=installTrackArtist">' . "\n";
    $header['head'] .= "\t" . '<link rel="search" type="application/opensearchdescription+xml" title="O!MPD - Title" href="' . NJB_HOME_URL . 'opensearch.php?action=installTrackTitle">' . "\n";
}
$header['head'] .= "\t" . '<link rel="shortcut icon" type="image/png" href="image/o_lg.png">' . "\n";
예제 #16
0
<?php

if (!defined('IN_TBB')) {
    die;
}
$page = <<<END
- [BBCODE_OVERRIDE]b]text[BBCODE_OVERRIDE]/b]: [b]bold[/b]
- [BBCODE_OVERRIDE]i]text[BBCODE_OVERRIDE]/i]: [i]italics[/i]
- [BBCODE_OVERRIDE]u]text[BBCODE_OVERRIDE]/u]: [u]underline[/u]
- [BBCODE_OVERRIDE]s]text[BBCODE_OVERRIDE]/s]: [s]strikethrough[/s]
- [BBCODE_OVERRIDE]url]http://www.google.com[BBCODE_OVERRIDE]/url]: [url]http://www.google.com[/url]
- [BBCODE_OVERRIDE]url=http://www.google.com]masked URL[BBCODE_OVERRIDE]/url]: [url=http://www.google.com]masked URL[/url]
- [BBCODE_OVERRIDE]spoiler]text[BBCODE_OVERRIDE]/spoiler]:
[spoiler]text[/spoiler]
- [BBCODE_OVERRIDE]spoiler=NSMB]Bowser dies[BBCODE_OVERRIDE]/spoiler]: [spoiler=NSMB]Bowser dies[/spoiler]
- [BBCODE_OVERRIDE]quote]quoted text[BBCODE_OVERRIDE]/quote]: [quote]quoted text[/quote]
- [BBCODE_OVERRIDE]quote=person]quoted text[BBCODE_OVERRIDE]/quote]: [quote=person]quoted text[/quote]
- [BBCODE_OVERRIDE]code]code[BBCODE_OVERRIDE]/code]: [code]code[/code]
- [BBCODE_OVERRIDE]size=10px]small text[BBCODE_OVERRIDE]/size]: [size=10px]small text[/size]
END;
print "<div style='text-align: left; width: 80%; padding: 2px; margin: 0 auto; border: 1px solid #aad6ff'>";
print getpost($page, true, true, true);
print "</div>";
예제 #17
0
$panetag = getpost('panetag');
$position = getpost('position');
$datapt = getpost('datapt');
$resolution = getpost('resolution');
$style = getpost('style');
$width = getpost('width');
$height = getpost('height');
$ymax = getpost('ymax');
$ymin = getpost('ymin');
$average = getpost('average');
$linethick = getpost('linethick');
$linesmooth = getpost('linesmooth');
$linecolor = getpost('linecolor');
$multiplier = getpost('multiplier');
$viewname = getpost('viewname');
$viewtemplate = getpost('viewtemplate');
###  TABLE MAINTENANCE
###
###############################################
//check views table
$query = "show tables like 'blackboxviews'";
$result = $db->query($query) or codeerror('DB error', __FILE__, __LINE__);
if (!$db->num_rows($result)) {
    $query = "\r\n\t\tcreate table blackboxviews (\r\n\t\t\tid_view      int unsigned primary key auto_increment,\r\n\t\t\tviewname     varchar(255) not null,\r\n\t\t\ttemplate     varchar(255) not null,\r\n\t\t\ttype         char(1) not null,\r\n\t\t\tsettings     text not null,\r\n\t\t\tposition     tinyint unsigned not null\r\n\t\t);\r\n\t";
    if (!$db->query($query)) {
        $page->tags['PageTitle'] = 'Error';
        $page->tags['Body'] = "Our attempt to add the views table failed. That means your database/permissions are not set right.";
        $page->render();
    }
}
//check elements table
예제 #18
0
 			$this->tms = $this->db->jdate($obj->tms);
 			$this->entity = $obj->entity;*/
 $object->rowid = $rowid;
 $object->ref_interne = $ref_interne;
 $object->date_contrat = $datecontrat;
 $object->fk_soc = $socid;
 //$object->commercial_suivi_id		= GETPOST('commercial_suivi_id','int');
 //$object->commercial_signature_id	= GETPOST('commercial_signature_id','int');
 $object->note_private = GETPOST('note_private', 'alpha');
 $object->note_public = GETPOST('note_public', 'alpha');
 $object->fk_biens = GETPOST('biensid', 'int');
 $object->date_cloture = GETPOST('date_cloture');
 $object->status = GETPOST('status');
 $object->mise_en_service = GETPOST('mise_en_service');
 $object->fin_validite = GETPOST('fin_validite');
 $object->fk_bails = getpost('bailid', 'int');
 //   $object->fk_commercial = GETPOST('commercial_suivi_id','int');
 // If creation from another object of another module (Example: origin=propal, originid=1)
 if ($_POST['origin'] && $_POST['originid']) {
     // Parse element/subelement (ex: project_task)
     $element = $subelement = $_POST['origin'];
     if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) {
         $element = $regs[1];
         $subelement = $regs[2];
     }
     // For compatibility
     if ($element == 'order') {
         $element = $subelement = 'commande';
     }
     if ($element == 'propal') {
         $element = 'comm/propal';
예제 #19
0
      This is just for testing Treeki's custom forum software which will most likely never be finished.
    </td>
  </tr>
  <tr>
    <td style='width: 70%' valign='top'>
<?php 
if ($portalforum > -1) {
    $getnews = dbquery("SELECT * FROM threads WHERE forum = {$portalforum} ORDER BY id DESC LIMIT 5");
    while ($thread = dbrow($getnews)) {
        $thread[name] = htmlspecialchars($thread[name]);
        $threadid = $thread[id];
        $post = dbrow(dbquery("SELECT posts.id,posts.postdate,posts.posttext,users.userid,users.username,users.powerlevel FROM posts LEFT JOIN users ON posts.authorid=users.userid WHERE thread = {$threadid} ORDER BY postdate LIMIT 1"));
        $author = userlink($post[userid], htmlspecialchars($post[username]), $post[powerlevel]);
        $postdate = parsedate_short($post[postdate]);
        print "<div class='portalheader'><b>{$thread['name']}</b> (<i>{$postdate} by {$author}</i>)</div>";
        $posttext = getpost($post[posttext], true, true, false);
        print "<div class='portalbox'>";
        print $posttext;
        print "<div style='text-align: center; padding: 2px; margin: 2px 0px; border-top: 1px solid #aad6ff'><a href='index.php?showthread={$threadid}'>view original thread</a> ({$thread['replies']} replies)</div>";
        print "</div>";
    }
}
?>
    </td>
    <td style='width: 30%' valign='top'>
      <div class='portalheader'>Unused Box</div>
      <div class='portalbox' style='text-align: center'>
        Stuff can go here if you want. Edit modules/main.php.
      </div>
<?php 
$groupbit = '';
예제 #20
0
 *  ==
 *  Build and render a power monitor 'view'. 
 * 
 *  @package:  The Blackbox Project.
 *  @author:   Peter 2013
 *  @license:  GPLv3. 
 *  @revision: $Rev$
 *
 **/
### Prep
include 'init.php';
//additional config
$REFRESH_RATE = 60;
//webpage met refresh rate in seconds
//get view
$id_view = (int) getpost('id_view');
$id_view = $id_view ? $id_view : 1;
$query = "select template from blackboxviews where id_view=':id_view' ";
$params = array('id_view' => $id_view);
$result = $db->query($query, $params) or codeerror('DB error', __FILE__, __LINE__);
$row = $db->fetch_row($result) or die('Invalid id' . __LINE__);
$viewtemplate = $row['template'];
//create page from view template
$page = new Page($viewtemplate);
//get all modules with todays data preloaded
$blackbox = new Blackbox(true);
$modules = $blackbox->modules;
### Build page
//get elements
$query = "\r\n\tselect * from blackboxelements\r\n\twhere id_view=':id_view'\r\n\torder by panetag,position\r\n";
$params = array('id_view' => $id_view);
예제 #21
0
// allows you to download the 1s series data for a given iso date
// defaults to today
### Prelim
//php set
ini_set('display_errors', 'on');
require "init.php";
$set['4115'] = 'Vbat';
$set['4116'] = 'Vpv';
$set['4117'] = 'Iout';
$set['4120'] = 'Stage';
$set['4121'] = 'Ipv';
$set['4132'] = 'Tbat';
$set['4133'] = 'Tfat';
$set['4371'] = 'Iwb';
$set['4373'] = 'SOC';
$day = getpost('day');
if (!preg_match("/\\d\\d\\d\\d-\\d\\d-\\d\\d/", $day)) {
    $day = '';
}
if (!$day) {
    $day = date('Y-m-d');
}
if ($day == date('Y-m-d')) {
    $fname = "/var/tmp/blackbox/{$day}.txt";
    if (!file_exists($fname)) {
        die("No data file - {$fname}");
    }
    $lines = file($fname);
} else {
    $fname = "/home/data/daily/{$day}.txt.bz2";
    if (!file_exists($fname)) {
예제 #22
0
//  |                                                                        |
//  | This program is distributed in the hope that it will be useful,        |
//  | but WITHOUT ANY WARRANTY; without even the implied warranty of         |
//  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          |
//  | GNU General Public License for more details.                           |
//  |                                                                        |
//  | You should have received a copy of the GNU General Public License      |
//  | along with this program.  If not, see <http://www.gnu.org/licenses/>.  |
//  +------------------------------------------------------------------------+
//  +------------------------------------------------------------------------+
//  | config.php                                                             |
//  +------------------------------------------------------------------------+
require_once 'include/initialize.inc.php';
$cfg['menu'] = 'config';
$action = getpost('action');
$update = getpost('update');
if ($action == '') {
    config();
} elseif ($action == 'playerProfile') {
    playerProfile();
} elseif ($action == 'editPlayerProfile') {
    editPlayerProfile();
} elseif ($action == 'setPlayerProfile') {
    setPlayerProfile();
    playerProfile();
} elseif ($action == 'setDefaultPlayerProfile') {
    setDefaultPlayerProfile();
    playerProfile();
} elseif ($action == 'savePlayerProfile') {
    savePlayerProfile();
    playerProfile();
예제 #23
0
            print "<tr><td>";
            print "<a href='index.php?m=messages&act=send&target={$member['userid']}'>Send PM</a>";
            print " - ";
            print "<a href='index.php?m=reputation&id={$member['userid']}'>Rate User</a>";
            print "</td></tr>";
            print "</table></td>";
            // end left bit
            // right bit
            print "<td style='width: 50%' valign='top'>";
            print "<table class='styled' style='width: 100%'>";
            print "<tr class='header'><td colspan='2'>Personal Info</td></tr>";
            if ($member[info]) {
                $info = getpost($member[info], true, true, false);
                print "<tr><td colspan='2' style='text-align: left'>{$info}</td></tr>";
            } else {
                print "<tr><td colspan='2'>None. You can go to your User CP to edit this area!</td></tr>";
            }
            print "<tr class='header'><td colspan='2'>Signature</td></tr>";
            if ($member[signature]) {
                $sig = getpost($member[signature], true, true, false);
                print "<tr><td colspan='2' style='text-align: left'>{$sig}</td></tr>";
            } else {
                print "<tr><td colspan='2'>(none)</td></tr>";
            }
            print "</table></td>";
            // end right bit
            print "</table>";
            print "<br><a href='index.php?m=users'>Return to the member list</a>";
        }
        break;
}
예제 #24
0
                $alternating = !$alternating;
                if ($alternating) {
                    $alt = " class='rowalt'";
                } else {
                    $alt = "";
                }
                print "<tr{$alt}>";
                print "<td align='left' valign='top'>";
                $userlink = userlink($row[userid], htmlspecialchars($row[username]), $row[powerlevel]);
                $date = parsedate($row[date]);
                print "<span style='font-size: 11px'>{$userlink} rated at {$date}:";
                if ($candelete) {
                    print " (<a href='index.php?m=reputation&id={$userid}&deleterep={$row['id']}'>delete</a>)";
                }
                print "</span>";
                print "<div class='smallspacing'></div>";
                if ($row[rep] > 0) {
                    $outcome = "<span style='color: #248900'>Positive (+{$row['rep']})</span>";
                } elseif ($row[rep] == 0) {
                    $outcome = "<span style='color: #565656'>Neutral ({$row['rep']})</span>";
                } elseif ($row[rep] < 0) {
                    $outcome = "<span style='color: #af3333'>Negative ({$row['rep']})</span>";
                }
                print "{$outcome}: " . getpost($row[content], true, true, false);
                print "</td>";
                print "</tr>";
            }
            print "</table>";
        }
    }
}
예제 #25
0
 public function ADD()
 {
     if (isset($_POST['sigup'])) {
         $user = getpost('user');
         $pass = getpost('pass');
         $repass = getpost('repass');
         ob_start();
         $pattern = '/[a-z][A-Z]^[0-9]+$/';
         $number = '/[0-9]+$/';
         $subject = '0979306603';
         if ($user != null) {
             if (!preg_match($number, $user[0], $matches)) {
                 if ($pass != null) {
                     if ($pass = $repass) {
                         $data = $this->Model->database->add($user, $pass);
                         if ($data == 1) {
                             $ero = " loi tai khoai da ton tai! ";
                         } else {
                             header('location:index.php?controll=kiemtra&action=manager');
                         }
                     } else {
                         $ero = "Mat khau nhap không khop! ";
                     }
                 } else {
                     $ero = "Ban chưa nhập pass! ";
                 }
             } else {
                 $ero = "Đầu tiên là chữ";
             }
         } else {
             $ero = "Ban chua nhap user! ";
         }
     }
     $content = ob_get_contents();
     ob_end_clean();
     $this->View->load("add", array("ero" => $ero, "content" => $content, "user" => $user, "pass" => $pass, "repass" => $repass));
     $this->View->Show();
 }
예제 #26
0
                </div>
                <!-- /.row -->

                <?php 
if (empty($_GET['id'])) {
    ?>
                    <div class="alert alert-danger">
                        <strong>Error!</strong> No se encontro la post al que aplicar esta accion.
                    </div>
                <?php 
} else {
    ?>

                <?php 
    $_SESSION['idpst'] = $_GET['id'];
    $arrUser = getpost($_SESSION['idpst']);
    ?>
                <div class="row">
                    <div class="col-lg-8">

                        <form role="form" id="frmUser" method="post" action="crudUser.php?action=update">
                            <div class="form-group">
                                <label>Utc</label>
                                <input id="Utc" name="Utc" class="form-control" value="<?php 
    echo $arrUser['Utc'];
    ?>
" placeholder="Utc">
                                <p class="help-block">Utc.</p>
                            </div>

                            <div class="form-group">
예제 #27
0
파일: profile.edit.php 프로젝트: h3rb/page
include 'core/Page.php';
if (!Session::logged_in()) {
    Page::Redirect('login');
}
if (!Auth::ACL("admin") && !Auth::ACL("su")) {
    Page::Redirect('dash');
}
$p = new Page();
if (!$p->ajax) {
    $p->HTML('header.html', array("###MENU###" => Dropdown_menu($p)));
}
$p->title = "Your Website";
$p->CSS("main.css");
$p->Jquery();
$getpost = getpost();
if (!isset($getpost['ID'])) {
    Page::Redirect('dash');
}
if (isset($getpost['new'])) {
    $p->JS('notifier.js');
    $p->JS('Notifier.info("Editing new Item");');
}
$p->HTML('<BR>');
global $auth_database;
$profile_model = new Profile($auth_database);
$auth_model = new Auth($auth_database);
$a = $auth_model->Get($getpost['ID']);
if (false_or_null($a)) {
    Page::Redirect('profiles');
}
예제 #28
0
            print "This thread has been locked.<br><a href='index.php?showthread={$threadid}'>Return to the thread</a>";
        } else {
            // if it returns a non-blank string, it's an error
            // if it returns true (check with ===) the reply has been posted successfully
            // if it returns nothing, just show the form
            $result = post_reply();
            if ($result === true) {
                $postid = mysql_insert_id();
                header("Location: index.php?showthread={$threadid}&post={$postid}#post{$postid}");
            } else {
                if ($result != '') {
                    print '<b>The following errors occurred while posting your reply:<br>' . $result . '</b><br>Your post data has been saved.<hr>';
                }
                if (isset($_POST['preview'])) {
                    print "<b>Preview:</b>";
                    $posttext = getpost($_POST['text'], true, true, false);
                    display_post($s[user], 'Posted', time(), $cmds, $posttext);
                    print "<br>";
                }
                if (isset($_GET['quote'])) {
                    $quoteid = intval($_GET[quote]);
                    $getquote = dbquery("SELECT * FROM posts WHERE id = {$quoteid} AND thread = {$threadid}");
                    if (dbrows($getquote) != 0) {
                        // ignore the quote if it's an invalid id
                        $quotepost = dbrow($getquote);
                        $quotetime = parsedate($quotepost[postdate]);
                        $quote = "[quote={$quotepost['authorname']} ({$quotetime})]{$quotepost['posttext']}[/quote]\n\n";
                    }
                }
                ?>
<b>Replying to <?php 
예제 #29
0
    } else {
        include "sections/forum/forum_board.php";
    }
} else {
    ############################
    ///////////////////////
    // LIST CATS & BOARDS
    ///////////////////////
    $catsquery = $db->query_str("SELECT * FROM {$tab['forum_board']} WHERE is_cat='1' AND visible='1' ORDER BY sort");
    while ($cat = $db->fetch_array($catsquery)) {
        unset($j, $incf[boardbit]);
        $boardsquery = $db->query_str("SELECT * FROM {$tab['forum_board']} WHERE is_cat='0' AND parent_boardid='{$cat['id']}' AND visible='1' ORDER BY sort");
        while ($board = $db->fetch_array($boardsquery)) {
            //if(!($j%3) && $j) {eval("\$incf[boardbit] .= \"".gettemplate("forum.index.board.bit.tr")."\";");}
            if ($board[last_postid]) {
                $lastpost = getpost($board[last_postid]);
            } else {
                unset($lastpost[settime]);
            }
            if ($board[board_password] && !checkboardpassword($boardpassword_c["{$board['id']}"], $board)) {
                eval("\$lastposting = \"" . gettemplate("forum.index.board.bit.lastposting.pwd.noaccess") . "\";");
            } else {
                if ($board[last_userid]) {
                    $lastuser = getuser($board[last_userid]);
                    $last_user_name = mkuser("user_name", $NULL, $lastuser);
                    $last_time = mkdate($lastpost[settime]);
                    eval("\$lastposting = \"" . gettemplate("forum.index.board.bit.lastposting") . "\";");
                } else {
                    eval("\$lastposting = \"" . gettemplate("forum.index.board.bit.nolastposting") . "\";");
                }
            }
예제 #30
0
print "<form action='index.php?m=admin&act=idx' method='post'>";
print "<textarea rows='4' cols='70' name='data'></textarea>";
print "<br>";
print "<input type='submit' name='makeit' value='Add Note' class='button'>";
print "</form>";
print "<hr>";
$getnotes = dbquery("select adminnotes.*,users.userid,users.username,users.powerlevel from adminnotes left join users on adminnotes.author=users.userid order by adminnotes.notedate");
if (mysql_num_rows($getnotes) == 0) {
    print "Apparently no one has posted any notes yet.";
} else {
    $alternating = true;
    print "<table cellpadding='0' cellspacing='0' style='width: 100%' id='rep'>";
    while ($row = dbrow($getnotes)) {
        $alternating = !$alternating;
        if ($alternating) {
            $alt = " class='rowalt'";
        } else {
            $alt = "";
        }
        print "<tr{$alt}>";
        print "<td align='left' valign='top'>";
        $userlink = userlink($row[userid], htmlspecialchars($row[username]), $row[powerlevel]);
        $date = parsedate($row[notedate]);
        print "<span style='font-size: 11px'>{$userlink} posted at {$date}:</span>";
        print "<div class='smallspacing'></div>";
        print getpost($row[data], true, true, false);
        print "</td>";
        print "</tr>";
    }
    print "</table>";
}