Пример #1
0
 /* Secondary groups management */
 if ($FH->isUpdated("secondary")) {
     $old = getUserSecondaryGroups($uid);
     $new = $FH->getValue('secondary');
     foreach (array_diff($old, $new) as $group) {
         del_member($group, $uid);
         callPluginFunction("delUserFromGroup", array($uid, $group));
     }
     foreach (array_diff($new, $old) as $group) {
         add_member($group, $uid);
         callPluginFunction("addUserToGroup", array($uid, $group));
     }
 }
 /* Password change management */
 if ($mode == 'edit' && $FH->getValue('pass')) {
     $ret = callPluginFunction("changeUserPasswd", array(array($uid, prepare_string($FH->getValue('pass')))));
     if (isXMLRPCError()) {
         $error .= _("Password not updated") . "<br />";
     } else {
         $result .= _("Password updated") . "<br />";
     }
 }
 /* Global disable account */
 if ($mode == 'edit') {
     if ($FH->getPostValue('disableAccount')) {
         $ret = callPluginFunction("disableUser", array($uid));
         foreach ($ret as $plugin => $err) {
             if ($err != 0 && $err != NULL) {
                 $result .= sprintf(_("Failed to disable user in %s plugin"), $plugin) . "<br />";
             }
         }
Пример #2
0
     $width = $filter->get('width-i', 'INTEGER');
     $height = $filter->get('height-i', 'INTEGER');
 }
 if ($name == '') {
     $errors[] = $lang['album.name_empty'];
     $err['name'] = 1;
 }
 if ($category == '0') {
     $errors[] = $lang['album.category_empty'];
     $err['category'] = 1;
 }
 if ($tags == '') {
     $errors[] = $lang['album.tags_empty'];
     $err['tags'] = 1;
 } else {
     $tags = prepare_string($tags, false);
 }
 if ($type == '') {
     $errors[] = $lang['album.type_empty'];
     $err['type'] = 1;
 }
 if (!$errors) {
     $src = $config['BASE_DIR'] . '/tmp/albums/' . $pid . '_' . $random . '.jpg';
     $dst = $config['BASE_DIR'] . '/media/albums/' . $aid . '.jpg';
     if (file_exists($src) && is_file($src)) {
         $image = new VImageConv();
         $image->process($src, $dst, 'EXACT', $width, $height);
         $image->crop($x, $y, $width, $height, true);
         unlink($src);
     }
     $type = ($type == 'public' or $type == 'private') ? $type : 'public';
Пример #3
0
            $data['status'] = 1;
            $data['code'] = $code;
            $data['cid'] = $cid;
            $data['gid'] = $gid;
            $data['msg'] = show_msg($lang['global.comment_success']);
            $_SESSION['g_comment_added'] = time();
            $sql = "SELECT g.title, s.username, s.email, u.game_comment\n                       FROM game AS g, signup AS s, users_prefs AS u \n                       WHERE g.GID = " . $gid . "\n                       AND g.UID = s.UID\n                       AND s.UID = u.UID \n                       LIMIT 1";
            $data['debug'] = $sql;
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() === 1) {
                $prefs_g_comment = $rs->fields['game_comment'];
                if ($prefs_g_comment == '1') {
                    $email = $rs->fields['email'];
                    $username = $rs->fields['username'];
                    $title = $rs->fields['title'];
                    require $config['BASE_DIR'] . '/classes/file.class.php';
                    require $config['BASE_DIR'] . '/classes/email.class.php';
                    $game_link = $config['BASE_URL'] . '/game/' . $gid . '/' . prepare_string($title);
                    $search = array('{$username}', '{$site_title}', '{$site_name}', '{$baseurl}', '{$game_link}');
                    $replace = array($_SESSION['username'], $config['site_title'], $config['site_name'], $config['BASE_URL'], $game_link);
                    $mail = new VMail();
                    $mail->sendPredefined($email, 'game_comment', $search, $replace);
                }
            }
        }
    } else {
        $data['msg'] = show_err($lang['ajax.game_comment_login']);
    }
}
echo json_encode($data);
die;
Пример #4
0
             $image->process($src, $dst, 'MAX_WIDTH', 960, 0);
             $image->resize(true, true);
         }
     }
 }
 $src = $config['BASE_DIR'] . '/media/photos/tmb/' . $album_cover_id . '.jpg';
 $dst = $config['BASE_DIR'] . '/media/albums/' . $album_id . '.jpg';
 $image->process($src, $dst, 'MAX_WIDTH', 400, 0);
 $image->resize(true, true);
 $sql = "UPDATE albums SET total_photos = " . intval($photos) . " WHERE AID = " . $album_id . " LIMIT 1";
 $conn->execute($sql);
 $sql = "UPDATE channel SET total_albums = total_albums+1 WHERE CHID = " . $category . " LIMIT 1";
 $conn->execute($sql);
 $sql = "UPDATE signup SET total_albums = total_albums+1, points = points+5 WHERE UID = " . $uid . " LIMIT 1";
 $conn->execute($sql);
 $album_url = $config['BASE_URL'] . '/album/' . $album_id . '/' . prepare_string($name);
 $album_link = '<a href="' . $album_url . '">' . $album_url . '</a>';
 $search = array('{$site_title}', '{$site_name}', '{$username}', '{$album_link}', '{$baseurl}');
 $replace = array($config['site_title'], $config['site_name'], $_SESSION['username'], $album_link, $config['BASE_URL']);
 $mail = new VMail();
 if ($config['approve'] == '0') {
     $mail->sendPredefined($_SESSION['email'], 'photo_approve', $search, $replace);
 } else {
     $mail->sendPredefined($_SESSION['email'], 'photo_upload', $search, $replace);
 }
 $album['name'] = '';
 $album['category'] = 0;
 $album['tags'] = '';
 $album['anonymous'] = 'no';
 $album['type'] = 'public';
 if ($config['approve_photos'] == '1') {
Пример #5
0
/**
 * add a user
 * @param $login user's login
 * @param $pass user's pass
 * @param $firstname user's firstname
 * @param $name user's name
 * @param $homedir user home directory
 */
function add_user($login, $pass, $firstname, $name, $homedir, $createhomedir, $ownHomeDir, $primaryGroup = "")
{
    $param = array($login, prepare_string($pass), $firstname, $name, $homedir, $createhomedir, $ownHomeDir, $primaryGroup);
    $ret = xmlCall("base.createUser", $param);
    if ($ret == 5) {
        $msg = sprintf(_("User %s created but password is not valid regarding your password policies.<br/><strong>You must change the user password.</strong>"), $login) . "<br />";
        return array("code" => $ret, "info" => $msg);
    } else {
        if ($ret == 10) {
            $msg = _("You cannot add more users.") . "<br />";
            new NotifyWidgetFailure($msg);
            header('Location: ' . urlStrRedirect("base/users/index"));
            exit;
        } else {
            $msg = sprintf(_("User %s successfully created"), $login) . "<br />";
            return array("code" => $ret, "info" => $msg);
        }
    }
}
Пример #6
0
            $code .= '</div>';
            $code .= '<div class="clear"></div>';
            $code .= '</div>';
            $code .= '</div>';
            $data['code'] = $code;
            $data['cid'] = $cid;
            $data['bid'] = $bid;
            $_SESSION['b_comment_added'] = time();
            $sql = "SELECT b.UID, b.title, s.email, u.blog_comment  \n                       FROM blog AS b, users_prefs AS u, signup AS s \n                       WHERE b.BID = " . $bid . " \n                       AND b.UID = u.UID \n                       AND b.UID = s.UID \n                       LIMIT 1";
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() === 1) {
                $prefs_b_comment = $rs->fields['blog_comment'];
                if ($prefs_b_comment == '1') {
                    $email = $rs->fields['email'];
                    $title = $rs->fields['title'];
                    require $config['BASE_DIR'] . '/classes/file.class.php';
                    require $config['BASE_DIR'] . '/classes/email.class.php';
                    $blog_link = '<a href="' . $config['BASE_URL'] . '/blog/' . $bid . '/' . prepare_string($title) . '">' . $config['BASE_URL'] . '/blog/' . $bid . '/' . prepare_string($title) . '</a>';
                    $search = array('{$username}', '{$site_title}', '{$site_name}', '{$baseurl}', '{$blog_link}');
                    $replace = array($_SESSION['username'], $config['site_title'], $config['site_name'], $config['BASE_URL'], $blog_link);
                    $mail = new VMail();
                    $mail->sendPredefined($email, 'blog_comment', $search, $replace);
                }
            }
        }
    } else {
        $data['msg'] = $lang['ajax.comment_login'];
    }
}
echo json_encode($data);
die;
/**
 * extract_sentences
 * 
 * takes a string, cleans it, then returns a substring, 
 * ensuring that only complete sentences are returned and
 * the string is at least $min_words long
 *
 * @param 	string	$string		the original string
 * @param 	int		$min_words	the minimum words to be included in the returned string
 * @return	string	$extract	the resulting extract
 */
function extract_sentences($string, $min_words = 50)
{
    $string = prepare_string($string);
    // prepare string
    $words = explode(' ', $string);
    // split string into words
    // recompile into a string with min number of words
    $init_string = implode(" ", array_slice($words, 0, $min_words - 1));
    $init_size = strlen($init_string);
    // count initial string length (in characters)
    $stop = strcspn($string, ".!?", $init_size);
    // get the next chunk of text, stopping at sentence terminator
    $stop = $init_size + $stop + 1;
    // this calculates the final length of the string
    $extract = substr($string, 0, $stop);
    // finally we get the substring
    return $extract;
}
Пример #8
0
    if (!empty($details['summary'])) {
        echo '
		<itunes:subtitle text="' . $details['summary'] . '"/>';
    }
    // itunes summary
    if (!empty($details['description'])) {
        echo '
		<itunes:summary text="' . $details['description'] . '"/>';
    }
    echo '
		<itunes:explicit>no</itunes:explicit>';
}
// loop through content
foreach ($feed_content as $item) {
    $item_title = $item['title'];
    $item_description = empty($item['summary']) ? create_summary($item['body']) : prepare_string($item['summary']);
    $item_body = '';
    // show complete article?
    if (!empty($config['admin']['complete_feed'])) {
        $body_text = "<p><strong>" . $item_description . "</strong></p>";
        $body_text .= strip_inline_styles($item['body']);
        $item_body = "<content:encoded><![CDATA[" . $body_text . "]]></content:encoded>";
    }
    $item_date = date('r', strtotime($item['date_uploaded']));
    // start output to browser
    echo '
		<item>
			<title>' . $item_title . '</title>
			<description>' . $item_description . '</description>
			' . $item_body . '
			<link>' . $item['link'] . '</link>';
Пример #9
0
                $sql_add[] = "'" . mysql_real_escape_string($user) . "'";
            }
            $sql = "SELECT email FROM signup WHERE username in (" . implode(',', $sql_add) . ")";
            $rs = $conn->execute($sql);
            $users_emails = $rs->getrows();
            foreach ($users_emails as $user) {
                $emails[] = $user['email'];
            }
        }
        if (!$emails) {
            $data['msg'] = show_err_mb($lang['ajax.share_recipient_valid']);
        } else {
            $sql = "SELECT title FROM game WHERE GID = " . $game_id . " LIMIT 1";
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() == 1) {
                $title = $rs->fields['title'];
                $url = '<a href="' . $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title) . '">' . $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title) . '</a>';
                $search = array('{$site_name}', '{$site_title}', '{$sender_name}', '{$message}', '{$baseurl}', '{$game_link}');
                $replace = array($config['site_name'], $config['site_title'], $from, $message, $config['BASE_URL'], $url);
                $mail = new VMail();
                $mail->sendPredefined($emails, 'share_game', $search, $replace);
                $data['status'] = 1;
                $data['msg'] = show_msg_mb($lang['ajax.share_success']);
            } else {
                $data['msg'] = show_err_mb($lang['ajax.share_game_failed']);
            }
        }
    }
}
echo json_encode($data);
die;
Пример #10
0
function wikipedia_track_search($track, $trackartist)
{
    debuglog("Searching Wikipedia for " . $track . " (song) by " . $trackartist, "WIKIPEDIA TRACK");
    $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track . " (song)") . '&srprop=score&format=xml');
    $albuminfo = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
    // Comments assume the following:
    // track is 'A Track'
    // artist is 'An Artist'
    $page = null;
    // Look for 'A Track (An Artist song)'
    foreach ($albuminfo->query->search->p as $id) {
        $searchstring = prepare_string($track) . '\\s+\\(' . prepare_string($trackartist) . ' song\\)';
        // debuglog("1. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
        if (preg_match('/^\\s*' . $searchstring . '/i', $id['title'])) {
            debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
            $page = $id['title'];
            break;
        }
    }
    // Look for 'A Track (song)'
    if ($page == null) {
        foreach ($albuminfo->query->search->p as $id) {
            $searchstring = prepare_string($track) . '\\s+\\(song\\)';
            // debuglog("2. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    // Look for 'A Track'
    if ($page == null) {
        foreach ($albuminfo->query->search->p as $id) {
            $searchstring = prepare_string($track);
            // debuglog("3. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '\\s*$/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    if ($page == null) {
        debuglog("Searching Wikipedia for " . $track, "WIKIPEDIA TRACK");
        $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track) . '&srprop=score&format=xml');
        $album2info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        foreach ($album2info->query->search->p as $id) {
            $searchstring = prepare_string($track);
            // debuglog("3. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '\\s*$/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    if ($page == null) {
        return null;
    }
    debuglog("Track search found page " . $page, "WIKIPEDIA TRACK");
    return get_wikipedia_page(preg_replace('/ /', '_', $page), "en.wikipedia.org", true);
}
Пример #11
0
<xml>
    <videos>
    <?php 
foreach ($videos as $video) {
    ?>
        <video>
            <title><?php 
    echo $video['title'];
    ?>
</title>
            <duration><?php 
    echo duration($video['duration']);
    ?>
</duration>
            <url><?php 
    echo $config['BASE_URL'] . '/video/' . $video['VID'] . '/' . prepare_string($video['title']);
    ?>
</url>
			<image><?php 
    echo get_thumb_url($video['VID']) . '/1.jpg';
    ?>
</image>
            <desc><?php 
    echo htmlspecialchars($video['description'], ENT_QUOTES, 'UTF-8');
    ?>
</desc>
            <stars><?php 
    echo $video['rate'];
    ?>
</stars>
        </video>
Пример #12
0
 $game_tmb_path = $config['BASE_DIR'] . '/media/games/tmb/orig/' . $game_tmb_file;
 if (!move_uploaded_file($_FILES['game_thumb_file']['tmp_name'], $game_tmb_path)) {
     $errors[] = $lang['upload.game_thumb_failed'];
 }
 if (!$errors) {
     require $config['BASE_DIR'] . '/classes/image.class.php';
     $src = $game_tmb_path;
     $dst = $config['BASE_DIR'] . '/media/games/tmb/' . $game_tmb_file;
     $image = new VImageConv();
     $image->process($src, $dst, 'MAX_WIDTH', 256, 144);
     $image->canvas(256, 144, '000000', true);
     $sql = "UPDATE game_categories SET total_games = total_games+1 WHERE category_id = " . $category . " LIMIT 1";
     $conn->execute($sql);
     $sql = "UPDATE signup SET total_games = total_games+1, points = points+5 WHERE UID = " . $uid . " LIMIT 1";
     $conn->execute($sql);
     $game_url = $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title);
     $game_link = '<a href="' . $game_url . '">' . $game_url . '</a>';
     $search = array('{$site_title}', '{$site_name}', '{$username}', '{$game_link}', '{$baseurl}');
     $replace = array($config['site_title'], $config['site_name'], $_SESSION['username'], $game_link, $config['BASE_URL']);
     $mail = new VMail();
     if ($config['approve_games'] == '0') {
         $mail->sendPredefined($_SESSION['email'], 'game_approve', $search, $replace);
     } else {
         $mail->sendPredefined($_SESSION['email'], 'game_upload', $search, $replace);
     }
     $game['title'] = '';
     $game['category'] = '';
     $game['keywords'] = '';
     $game['privacy'] = 'public';
     $game['anonymous'] = 'no';
     if ($config['approve_games'] == '1') {
Пример #13
0
 $duration = $vidinfo['ID_LENGTH'];
 $height = $vidinfo['ID_VIDEO_HEIGHT'];
 $width = $vidinfo['ID_VIDEO_WIDTH'];
 $fps = $vidinfo['ID_VIDEO_FPS'];
 $id_video_format = $vidinfo['ID_VIDEO_FORMAT'];
 $cgi = strpos(php_sapi_name(), 'cgi') ? 'env -i ' : NULL;
 // Proc
 $cmd = $cgi . $config['phppath'] . " " . $config['BASE_DIR'] . "/scripts/convert_videos.php" . " " . $vdoname . " " . $video_id . " " . $vdo_path . "";
 log_conversion($config['LOG_DIR'] . '/' . $video_id . '.log', $cmd);
 $lg = $config['LOG_DIR'] . '/' . $video_id . '.log2';
 run_in_background($cmd . ' > ' . $lg);
 $duration = get_video_duration($vdo_path, $video_id);
 $vkey = substr(md5($video_id), 11, 20);
 $sql = "UPDATE video SET duration = '" . mysql_real_escape_string($duration) . "', vkey = '" . $vkey . "',\n                                            vdoname = '" . mysql_real_escape_string($vdoname) . "', flvdoname = '" . mysql_real_escape_string($flvdoname) . "'\n                           WHERE VID = " . intval($video_id) . " LIMIT 1";
 $conn->execute($sql);
 $video_url = $config['BASE_URL'] . '/video/' . $video_id . '/' . prepare_string($title);
 $video_link = '<a href="' . $video_url . '">' . $video_url . '</a>';
 $sql = "SELECT sv.SUID, s.username, s.email FROM video_subscribe AS sv, signup AS s\n                           WHERE sv.UID = " . $uid . " AND sv.UID = s.UID";
 $rs = $conn->execute($sql);
 if ($conn->Affected_Rows() > 0) {
     $subscribers = $rs->getrows();
     $mail = new VMail();
     $mail->setNoReply();
     $sql = "SELECT * FROM emailinfo WHERE email_id = 'subscribe_email' LIMIT 1";
     $rs = $conn->execute($sql);
     $email_path = $config['BASE_DIR'] . '/templates/' . $rs->fields['email_path'];
     $sender = $anonymous == 'yes' ? 'anonymous' : $_SESSION['username'];
     $mail->Subject = str_replace('$sender_name', $sender, $rs->fields['email_subject']);
     foreach ($subscribers as $subscriber) {
         $smarty->assign('video_link', $video_link);
         $smarty->assign('username', $subscriber['username']);
Пример #14
0
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
if ($_SESSION["AUTH_METHOD"] == "login" || isset($_POST["bback"])) {
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
}
require "modules/base/includes/users.inc.php";
require "graph/header.inc.php";
require "localSidebar.php";
require "graph/navbar.inc.php";
$user = $_SESSION["login"];
$p = new PageGenerator(_("Reset your password"));
$p->setSideMenu($sidemenu);
$p->display();
if (isset($_POST["bchpasswd"]) && $_POST["newpass"] != "" && $_POST["newpass"] == $_POST["confpass"]) {
    callPluginFunction("changeUserPasswd", array(array($user, prepare_string($_POST["newpass"]), "", False)));
    if (!isXMLRPCError()) {
        $n = new NotifyWidgetSuccess(_("Your password has been changed."));
    }
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
} else {
    ?>
<form action="<?php 
    echo "main.php?module=base&submod=users&action=resetpasswd";
    ?>
" method="post">
<p><?php 
    echo _("You are going to change your password");
    ?>
</p>
Пример #15
0
function addSmbAttr($uid, $passwd)
{
    return xmlCall("samba.addSmbAttr", array($uid, prepare_string($passwd)));
}
Пример #16
0
function send_album_approve_email($album_id)
{
    global $config, $conn;
    $sql = "SELECT a.AID, a.name, s.username, s.email FROM albums AS a, signup AS s\n\t               WHERE a.AID = " . intval($album_id) . " AND a.UID = s.UID\n\t\t\t\t   LIMIT 1";
    $rs = $conn->execute($sql);
    $aid = intval($rs->fields['AID']);
    $name = $rs->fields['name'];
    $username = $rs->fields['username'];
    $email = $rs->fields['email'];
    $album_url = $config['BASE_URL'] . '/album/' . $aid . '/' . prepare_string($name);
    $album_link = '<a href="' . $album_url . '">' . $album_url . '</a>';
    $search = array('{$site_title}', '{$site_name}', '{$username}', '{$album_link}', '{$baseurl}');
    $replace = array($config['site_title'], $config['site_name'], $username, $album_link, $config['BASE_URL']);
    if (!class_exists('VMail')) {
        require $config['BASE_DIR'] . '/classes/email.class.php';
    }
    $mail = new VMail();
    $mail->sendPredefined($email, 'video_approve', $search, $replace);
}
Пример #17
0
 $sql = "SELECT GID, title, addtime, rate, total_plays FROM game \n                       WHERE status = '1' AND category = '" . intval($game['category']) . "'" . $type . " AND GID != " . $gid . "\n                       AND ( title LIKE '%" . mysql_real_escape_string($game['title']) . "%' " . $sql_add . ") \n                       ORDER BY addtime DESC LIMIT " . $limit;
 $rs = $conn->execute($sql);
 $games = $rs->getrows();
 $code = array();
 $total_pages = $pagination->getTotalPages();
 $page = $page >= $total_pages ? $total_pages : $page;
 $code[] = '<div class="row">';
 foreach ($games as $game) {
     if ($game['type'] == 'private') {
         $img_class = 'class="img-responsive img-private"';
     } else {
         $img_class = 'class="img-responsive"';
     }
     $code[] = '<div class="col-sm-6 col-md-3 col-lg-3">';
     $code[] = '<div class="well well-sm m-b-0 m-t-20">';
     $code[] = '<a href="' . $config['BASE_URL'] . '/game/' . $game['GID'] . '/' . prepare_string($game['title']) . '">';
     $code[] = '<div class="thumb-overlay">';
     $code[] = '<img src="' . $config['BASE_URL'] . '/media/games/tmb/' . $game['GID'] . '.jpg" title="' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '" alt="' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '" ' . $img_class . ' />';
     if ($game['type'] == 'private') {
         $code[] = '<div class="label-private">' . $lang['global.PRIVATE'] . '</div>';
     }
     $code[] = '</div>';
     $code[] = '<span class="game-title title-truncate m-t-5">' . htmlspecialchars($game['title'], ENT_QUOTES, 'UTF-8') . '</span>';
     $code[] = '</a>';
     $code[] = '<div class="game-added">';
     $code[] = time_range($game['addtime']);
     $code[] = '</div>';
     $code[] = '<div class="game-views pull-left">';
     $views = $game['total_plays'] == '1' ? $lang['global.play'] : $lang['global.plays'];
     $code[] = $game['viewnumber'] . ' ' . $views;
     $code[] = '</div>';
Пример #18
0
 if (isset($_POST['edit_submit'])) {
     $filter = new VFilter();
     $title = $filter->get('title');
     $keyword = $filter->get('keyword');
     $channel = $filter->get('channel', 'INTEGER');
     $type = $filter->get('type');
     $thumb = $filter->get('thumb', 'INTEGER');
     if ($title == '') {
         $errors[] = $lang['upload.video_title_empty'];
         $err['title'] = 1;
     }
     if ($keyword == '') {
         $errors[] = $lang['upload.video_tags_empty'];
         $err['tags'] = 1;
     } else {
         $keyword = prepare_string($keyword, false);
     }
     if ($channel == '0') {
         $errors[] = $lang['global.category_empty'];
         $err['category'] = 1;
     }
     if (!$errors) {
         $type = $type == 'public' ? 'public' : 'private';
         $thumb = $thumb === 0 ? 1 : $thumb;
         $sql = "UPDATE video\n\t\t\t          SET title = '" . mysql_real_escape_string($title) . "',\n\t\t\t\t\t     keyword = '" . mysql_real_escape_string($keyword) . "',\n\t\t\t\t\t\t type = '" . $type . "',\n\t\t\t\t\t\t channel = '" . $channel . "',\n\t\t\t\t\t\t thumb = '" . $thumb . "'\n\t\t\t\t\t  WHERE VID = " . $vid . "\n\t\t\t\t\t  AND UID = " . $uid . "\n\t\t\t\t\t  AND active = '1'\n\t\t\t\t\t  LIMIT 1";
         $conn->execute($sql);
         $messages[] = $lang['edit.success'];
     }
 }
 $sql = "SELECT * FROM video WHERE VID = " . $vid . " AND UID = " . $uid . " AND active = '1' LIMIT 1";
 $rs = $conn->execute($sql);
Пример #19
0
 function modify()
 {
     if ($this->modifiable) {
         $user = $this->user;
         $login = $user["login"];
         // the following are not permitted to be changed yet
         unset($user["login"], $user["firstname"], $user["surname"], $user["homedir"], $user["createhomedir"], $user["primaryGroup"]);
         if (key_exists("password", $user)) {
             $ret = callPluginFunction("changeUserPasswd", array(array($login, prepare_string($user["password"]))));
             if (isXMLRPCError()) {
                 foreach ($ret as $info) {
                     $this->result .= _("Password not updated") . "<br/>";
                 }
                 # set errorStatus to 0 in order to make next xmlcalls
                 global $errorStatus;
                 $errorStatus = 0;
             } else {
                 //update result display
                 $this->result .= _("Password updated.") . "<br />";
             }
             unset($user["password"]);
         }
         if (count($user) > 0) {
             foreach ($user as $attribute => $value) {
                 if ($this->checkAttribute($attribute)) {
                     changeUserAttributes($login, $attribute, $value);
                 } else {
                     unset($user[$attribute]);
                 }
             }
             $this->result .= count($user) . _T("Attribute(s) modified", "bulkimport");
         }
     }
 }
Пример #20
0
require '../../include/dbconn.php';
function valid_email($email)
{
    return eregi("^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~^?])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~^?]+\\.)+[a-zA-Z]{2,4}\$", $email);
}
$video_id = isset($_GET['video_id']) && is_numeric($_GET['video_id']) ? intval($_GET['video_id']) : NULL;
if (isset($_POST['me']) && isset($_POST['to']) && isset($_POST['message'])) {
    $from = trim($_POST['me']);
    $to = trim($_POST['to']);
    $message = htmlspecialchars(trim($_POST['message']), ENT_QUOTES, 'UTF-8');
    if (valid_email($from) && valid_email($to)) {
        if ($video_id) {
            $sql = "SELECT VID, title FROM video WHERE VID = " . $video_id . " LIMIT 1";
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() === 1) {
                $title = prepare_string($rs->fields['title']);
                $video_url = $config['BASE_URL'] . '/video/' . $video_id . '/' . $title;
                $sql = "SELECT * FROM emailinfo WHERE email_id='player_email' LIMIT 1";
                $rs = $conn->execute($sql);
                if ($conn->Affected_Rows() === 1) {
                    require $config['BASE_DIR'] . '/classes/email.class.php';
                    require $config['BASE_DIR'] . '/classes/file.class.php';
                    $subject = $rs->fields['email_subject'];
                    $path = $config['BASE_DIR'] . '/templates/' . $rs->fields['email_path'];
                    $body = VFile::read($path);
                    $search = array('{$site_name}', '{$video_url}', '{$message}');
                    $replace = array($config['site_name'], $video_url, $message);
                    $body = str_replace($search, $replace, $body);
                    $mail = new VMail();
                    $mail->From = $from;
                    $mail->FromName = $from;
Пример #21
0
 $sql = "SELECT VID, title, duration, addtime, rate, likes, dislikes, viewnumber, type, thumb, thumbs, hd\n\t                   FROM video \n                       WHERE channel = '" . intval($video['channel']) . "' AND VID != " . $vid . "\n\t\t\t\t\t   AND active = '1'" . $type . "\n                       AND ( title LIKE '%" . mysql_real_escape_string($video['title']) . "%' " . $sql_add . ")\n                       ORDER BY addtime DESC LIMIT " . $limit;
 $rs = $conn->execute($sql);
 $videos = $rs->getrows();
 $code = array();
 $total_pages = $pagination->getTotalPages();
 $page = $page >= $total_pages ? $total_pages : $page;
 $code[] = '<div class="row">';
 foreach ($videos as $video) {
     if ($video['type'] == 'private') {
         $img_class = 'class="img-responsive img-private"';
     } else {
         $img_class = 'class="img-responsive"';
     }
     $code[] = '<div class="col-sm-6 col-md-3 col-lg-3">';
     $code[] = '<div class="well well-sm m-b-0 m-t-20">';
     $code[] = '<a href="' . $config['BASE_URL'] . '/video/' . $video['VID'] . '/' . prepare_string($video['title']) . '">';
     $code[] = '<div class="thumb-overlay">';
     $code[] = '<img src="' . get_thumb_url($video['VID']) . '/' . $video['thumb'] . '.jpg" title="' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '" alt="' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '" id="rotate_' . $video['VID'] . '_' . $video['thumbs'] . '_' . $video['thumb'] . '" ' . $img_class . ' />';
     if ($video['type'] == 'private') {
         $code[] = '<div class="label-private">' . $lang['global.PRIVATE'] . '</div>';
     }
     if ($video['hd'] == 1) {
         $code[] = '<div class="hd-text-icon">HD</div>';
     }
     $code[] = '<div class="duration">';
     $code[] = duration($video['duration']);
     $code[] = '</div>';
     $code[] = '</div>';
     $code[] = '<span class="video-title title-truncate m-t-5">' . htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8') . '</span>';
     $code[] = '</a>';
     $code[] = '<div class="video-added">';
Пример #22
0
 /**
  * [OVERRIDE] Cell method in tcpdf library.
  * Handle charset conversion and HTML entity decode.
  * This method override the regular Cell() method to apply the prepare_string() function to
  * the string to print in the PDF.
  * The cell method is used by all the methods which print text (Write, MultiCell).
  * @see include/tcpdf/TCPDF#Cell()
  */
 public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '', $stretch = 0)
 {
     parent::Cell($w, $h, prepare_string($txt), $border, $ln, $align, $fill, $link, $stretch);
 }
Пример #23
0
        echo '
		<itunes:summary text="' . $details['description'] . '"/>';
    }
    echo '
		<itunes:explicit>no</itunes:explicit>';
}
// loop through content
foreach ($feed_content as $item) {
    $item_title = $item['title'];
    $item_description = empty($item['summary']) ? create_summary($item['body']) : prepare_string($item['summary']);
    // show complete article?
    if (!empty($config['admin']['complete_feed'])) {
        if ($_GET['feed'] == 'comments') {
            $summary = "<p>" . $item['summary'] . "</p>";
        } else {
            $summary = !empty($item['summary']) ? "<p><strong>" . prepare_string($item['summary']) . "</strong></p>" : '';
        }
        $body = strip_inline_styles($item['body']);
        $item_description = "<![CDATA[" . $summary . $body . "]]>";
    }
    $item_date = date('r', strtotime($item['date_uploaded']));
    // start output to browser
    echo '
		<item>
			<title>' . $item_title . '</title>
			<description>' . $item_description . '</description>
			<link>' . $item['link'] . '</link>';
    // some additional entries for podcasts
    if ($_GET['feed'] == 'podcast') {
        echo "\n\t\t\t<itunes:author>" . $item['author_name'] . "</itunes:author>\n\t\t\t<dc:creator>" . $item['author_name'] . "</dc:creator>";
        if (!empty($item['seo_keywords'])) {