Example #1
0
function index_password()
{
    global $tpl, $config;
    $cfg = $config['recaptcha'];
    $tpl->assign('siteKey', $cfg['siteKey']);
    if (isset($_POST['valider'])) {
        if (isset($_POST['g-recaptcha-response'])) {
            $captcha = $_POST['g-recaptcha-response'];
        }
        $cfg = $config['recaptcha'];
        $secretKey = $cfg['secretKey'];
        if ($secretKey) {
            if (!$captcha) {
                $tpl->assign('msg', 'Erreur de captcha, veuillez resaisir les informations.');
                $tpl->assign('error_captcha', true);
                display();
                return;
            }
            $ip = $_SERVER['REMOTE_ADDR'];
            $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $captcha . "&remoteip=" . $ip);
            $responseKeys = json_decode($response, true);
            if (intval($responseKeys["success"]) !== 1) {
                $tpl->assign('msg', 'Erreur de captcha, veuillez resaisir les informations.');
                $tpl->assign('error_captcha', true);
                display();
                return;
            }
        }
        // Recherche du membre
        $mdl = new Modele('users');
        $mdl->find(array('user_email' => $_POST['mail']));
        if (!$mdl->next()) {
            $tpl->assign('msg', 'L\'adresse email est introuvable');
            $tpl->assign('error_mail', true);
            // Membre existe
        } else {
            $_SESSION['index_password_code'] = uniqid();
            $_SESSION['index_password_email'] = $_POST['mail'];
            $schema = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http';
            $tpl->assign('url', $schema . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . mkurl('index', 'password_change', array(session_name() => session_id(), 'valid' => $_SESSION['index_password_code'])));
            $mail = getMailer();
            $mail->AddAddress($_SESSION['index_password_email']);
            $mail->Subject = '[intra LATEB] mot de passe perdu';
            $mail->Body = $tpl->fetch('mail_password.tpl');
            $tpl->assign('msuccess', $mail->Send());
        }
    }
    display();
}
Example #2
0
</span>
						<?php 
            } elseif ($pagestart + 1 == $first) {
                ?>
							<span class="page"><?php 
                echo $pagenr;
                ?>
</span>
						<?php 
            } else {
                ?>
							<a class="page" href="<?php 
                echo get_uri('/packages/');
                ?>
?<?php 
                echo mkurl('O=' . $pagestart);
                ?>
"><?php 
                echo $pagenr;
                ?>
</a>
						<?php 
            }
            ?>
					<?php 
        }
        ?>
				</p>
				<?php 
    }
    ?>
Example #3
0
function rech_titles($rech, $dig, $opt, $cac, $cat, $tag, $tag2)
{
    list($bol, $ord, $tit, $pho) = split("-", $opt);
    $load = $_SESSION['load'];
    $days = geta('dig', $dig);
    $bol = substr($rech, -1) == '*' ? 1 : get('bool', $bol);
    $_GET['bool'] = $bol;
    //$_GET['pho']=$pho;
    $ret .= btn('search', input(1, 'search', $rech . '" size="32" maxlength="150', '')) . ' ';
    $ret .= ljb('popsav', 'Search2();', '', nms(24)) . ' ';
    $ret .= hlpbt('search') . ' ';
    if ($cac) {
        $ret .= blj('popbt', 'srcac', 'plug___search_rech*reset_' . $cac, picto('del'));
    }
    if ($load) {
        $ret .= btn("popw", nbof(count($load), 1));
    }
    //.', '.nbof(array_sum($load),19).' '
    if (rstr(3)) {
        $ret .= br() . dig_h($days);
    } else {
        $ret .= hidden('', 'srdig', 1000);
    }
    //days
    if (!isset($_SESSION['rstr62'])) {
        sesr('rstr62', rstr(62));
    }
    if (rstr(3)) {
        $ret .= togses('rstr62', pictit('right', nms(134))) . ' ';
    }
    //dig
    $urg = mkurl(array('bool', 'titles', 'cat', 'tag'));
    if ($rech) {
        $ret .= lkc('', htac('search') . $rech . '/' . $dig, picto('link')) . ' ';
    }
    //.$urg
    $ret .= br() . checkact('srord', $ord, nms(18)) . ' ';
    $ret .= checkact('srtit', $tit, nms(72)) . ' ';
    //$ret.=checkact('srpho',get('pho'),'').' ';//nms(123)
    $ret .= checkact('srbol', $bol, nms(70)) . '' . hlpbt('bool') . ' ';
    $ret .= select_j('srcat', 'category', $cat ? $cat : nms(9), 1) . ' ';
    //hidslct_j
    $ret .= select_j('srtag', 'tag', $tag ? $tag : 'tag', '');
    //$ret.=select_j('srtag2','thèmes',$tag3,'thèmes');
    return divc('titles', $ret);
}
Example #4
0
function fetch_web($schemas, $test = null)
{
    global $_user, $_channels;
    $updated_file = array();
    foreach ($schemas as $k => $v) {
        if (!$v->channel && $v->url == '' || $v->keywords == '') {
            continue;
        }
        if ($v->channel) {
            $url_arr = $_channels[$v->channel]['url'];
        } else {
            $url_arr = explode(' ', $v->url);
        }
        foreach ($url_arr as $url_key => $url) {
            $url = mkurl($v->channel, $url_key, $url, $v->url);
            $filename = md5($url) . '.tmp';
            if (in_array($filename, $updated_file)) {
                $html = file_get_contents(CACHE_PATH . $filename);
            } else {
                $file = '';
                $context = $v->channel ? mkfp_context($url_key) : null;
                $html = file_get_contents($url, false, $context);
                $html = format_script($html);
                file_put_contents(CACHE_PATH . $filename, $html);
                $updated_file[] = $filename;
            }
            //处理关键词
            $keywords = $v->keywords;
            $encoding = mb_detect_encoding($html, array('ASCII', 'GB2312', 'GBK', 'UTF-8'));
            if ($encoding == 'EUC-CN') {
                $encoding = 'GB2312';
                $keywords = iconv('UTF-8', 'GBK', $keywords);
            } elseif ($encoding == 'CP936') {
                $keywords = iconv('UTF-8', $encoding, $keywords);
            }
            $keywords = explode(' ', $keywords);
            $first_key = array_shift($keywords);
            $lpos = 0;
            $rpos = NULL;
            $len = strlen($first_key);
            for ($lpos = strpos($html, $first_key, $lpos); $lpos !== false; $lpos = strpos($html, $first_key, $lpos + $len)) {
                $rpos = find_key($html, $keywords, $lpos + $len);
                if ($rpos) {
                    $html_len = strlen($html);
                    //得到关键词上下文
                    for ($j = 1; $j < 6 && $lpos !== false; $j++) {
                        $lpos = strrpos($html, '</', $lpos - $html_len - 2);
                    }
                    if (!$lpos) {
                        $lpos = 0;
                    }
                    for ($i = 1; $i < 5; $i++) {
                        $rpos = strpos($html, '</', $rpos + 2);
                    }
                    if (!$rpos) {
                        $rpos = $html_len;
                    }
                    $result = substr($html, $lpos, $rpos - $lpos);
                    break;
                }
            }
            $result = trim(strip_tags($result, '<a>'));
            //确定包含数字
            if ($v->max_num != '' || $v->min_num != '') {
                $result = find_num($result, $v->max_num, $v->min_num);
            }
            if ($result) {
                $result = str_replace(array("\n", "\r", "\t", "  "), '', $result);
                if ($encoding != 'UTF-8') {
                    $result = substr($result, 0, 400);
                    $result = iconv('GBK', 'UTF-8', $result);
                } else {
                    $result = mb_substr($result, 0, 400, 'utf8');
                }
                $website = isset($_channels[$v->channel]['website'][$url_key]) ? $_channels[$v->channel]['website'][$url_key] : $url;
                $content = $result . "<a href='{$website}' target='_blank'>查看</a>";
                if ($test) {
                    return $content;
                } else {
                    $_user = user::get_one(array('user_id' => $v->user_id));
                    schema::update(array('status' => 'off', 'schema_id' => $v->schema_id));
                    msg::add(array('schema_id' => $v->schema_id, 'title' => $v->title, 'content' => $content, 'status' => 'new'));
                    $email = filter_var($_user->email, FILTER_VALIDATE_EMAIL);
                    if ($_user->email_notify == 'on' && $email) {
                        mail::send_cron($email, $v->title, $content);
                    }
                    if ($_user->app_notify == 'on' && $_user->baidu_uid) {
                        push::push_message($_user->baidu_uid, $v->title, $result);
                    }
                }
                $result = NULL;
                break;
            }
        }
    }
}
Example #5
0
    <channel>
        <title>{$title}</title>
        <link>https://kotomi-rss.moe/</link>
        <description>KOTOMI RSS 资源页</description>
        <language>zh-cn</language>
        <copyright>版权属于原作者所有,本站仅作索引。</copyright>
        <pubDate>{$date}</pubDate>

EOF;
foreach ($result as $res) {
    /// 对于漫游,使用 guid 作为资源链接,对于花园,使用 magnet 作为资源链接
    $link = $res['guid'];
    $btih = $res['btih'];
    if ($USE_LOCAL_SEED == TRUE && $btih != '') {
        $link = '/' . btih_seed_url($btih);
        $link = mkurl($link);
    }
    /**
     * 为向后兼容,对 guid 的特殊处理
     * 在 popgo-gone 版本之前,当 $USE_LOCAL_SEED == TRUE 时,对于漫游资源,我们会输出本地种子地址作为 guid
     * 而现在,我们会直接使用原始源的 RSS guid 作为 guid,也就是说,如果 USE_LOCAL_SEED == TRUE 时,如果我们不做处理,
     * 那么输出的 RSS 中的漫游资源的 guid 会改变,这会导致重复下载。
     * 为了解决此问题,在此对 guid 做特殊处理:
     * 1. 如果资源是漫游的,则按照旧方法对 guid 进行处理
     * 2. 如果资源不是漫游的,则直接输出原始 RSS 中的 guid
     */
    $guid = $res['guid'];
    if ($res['src'] == 'popgo') {
        $guid = $link;
    }
    /// 统一进行 HTML 转义
Example #6
0
			<p>
				<?php 
    echo parse_comment($row['Comments']);
    ?>
			</p>
		</div>
	<?php 
}
?>

<?php 
if ($count > 10 && !isset($_GET['comments'])) {
    ?>
	<h3>
		<a href="<?php 
    echo htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all');
    ?>
" title="<?php 
    echo __('View all comments');
    ?>
 (<?php 
    echo $count;
    ?>
)"><?php 
    echo __('All comments', $count);
    ?>
</a>
	</h3>
<?php 
}
?>
Example #7
0
print __("Go");
?>
' />
	<?php 
if (!empty($_GET['detail'])) {
    ?>
	<input type='submit' style='width:80px'  class='button' name='do_Orphans' value='<?php 
    print __("Orphans");
    ?>
' />

<?php 
}
?>
	<a href="?<?php 
print mkurl('detail=' . (!empty($_GET['detail']) ? 0 : 1));
?>
"><?php 
print __("Advanced");
?>
</a>
</div>

			<?php 
if (!empty($_GET['detail'])) {
    ?>
			<div id="advanced-search" class="blue">
				<input type="hidden" name="detail" value="1" />
				<ul>
					<li>
						<label><?php 
Example #8
0
                echo $i;
                ?>
</a>
					<?php 
            } else {
                echo "<span id=\"page_sel\">{$i}</span>";
            }
        }
        print $pages > $morepages ? '...' : '';
        ?>

			<?php 
        if ($total - $_GET['PP'] - $_GET['O'] > 0) {
            ?>
				<a class="page_num" href='packages.php?<?php 
            print mkurl('O=' . ($_GET['O'] + $_GET['PP']));
            ?>
'><?php 
            echo __('Next');
            ?>
</a>
			<?php 
        }
        ?>

			</div>

		</td>
	</tr>

<?php 
Example #9
0
/**
 * Génère une URL de la même page avec des paramètres différents
 * @param type $options
 */
function urldup($options)
{
    $opt = $_GET;
    unset($opt['action']);
    unset($opt['page']);
    $opt = array_merge($opt, $options);
    $action = 'index';
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    $page = 'index';
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    return mkurl($action, $page, $opt);
}