本文整理汇总了PHP中rewrite函数的典型用法代码示例。如果您正苦于以下问题:PHP rewrite函数的具体用法?PHP rewrite怎么用?PHP rewrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rewrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Main
function Main()
{
$clientUser = get('u', 'int');
if ( $clientUser != '' )
{
handler('cookie')->setVar('finderid', $clientUser);
handler('cookie')->setVar('findtime', time());
}
$data = logic('product')->display();
if (!$data && get('page', 'int') == 0)
{
header('Location: '.rewrite('?mod=subscribe&code=mail'));
exit;
}
$product = $data['product'];
$this->Title = $data['mutiView'] ? '' : $product['name'];
$data['mutiView'] || mocod('product.view');
$data['mutiView'] || productCurrentView($product);
$favorited = logic('favorite')->get_one($product['id']);
if(INDEX_DEFAULT === true && ini('settings.template_path') == 'meituan'){
$new_product = logic('product')->GetNewList(10, true);
if(empty($new_product)) {
$new_product = logic('product')->GetNewList(10);
}
}
include handler('template')->file($data['file']);
}
示例2: main
protected function main()
{
if (!is_logged_in()) {
header('Location: mobile.html');
}
$this->set_tpl('mobile/categories/list_news.html');
$this->load_lang_file('news');
// On compte le nbr de news en rédaction
inc_lib('news/count_news');
$nombre_news = count_news('n_etat = 1');
// Pagination
$page = (!empty($_GET['page']) and is_numeric($_GET['page']) and $_GET['page'] > 0) ? (int) $_GET['page'] : 1;
$nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']);
// On vérifie bien que la page existe
if ($nombreDePages > 0 && $page > $nombreDePages) {
redir(Nw::$lang['common']['pg_not_exist'], false, './mobile.html');
}
// On recherche toutes les news en rédaction
inc_lib('news/get_list_news');
$list_dn_news = get_list_news('n_etat = 1', 'n_date DESC', $page, Nw::$pref['nb_news_redac']);
// On affiche toutes les news en rédaction
foreach ($list_dn_news as $donnees_news) {
Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0));
}
Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $nombre_news, 'TITLE' => Nw::$lang['news']['en_attente_title'], 'TITLE_REWRITE' => 'news_en_attente', 'INC_HEAD' => empty($_SERVER['HTTP_AJAX'])));
}
示例3: get_list
function get_list($condition = '1', $order = 'addtime DESC')
{
global $pages, $page, $pagesize, $offset, $pagesize, $MOD, $item, $sum;
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}");
$item = $r['num'];
}
$pages = pages($item, $page, $pagesize);
$lists = $pids = $P = array();
$result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}");
while ($r = $this->db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
$r['linkurl'] = $MOD['linkurl'] . rewrite('price.php?itemid=' . $r['pid']);
$pids[$r['pid']] = $r['pid'];
$lists[] = $r;
}
if ($pids) {
$result = $this->db->query("SELECT * FROM {$this->table_product} WHERE itemid IN (" . implode(',', $pids) . ")");
while ($r = $this->db->fetch_array($result)) {
$P[$r['itemid']] = $r;
}
if ($P) {
foreach ($lists as $k => $v) {
$lists[$k]['unit'] = $P[$v['pid']]['unit'];
$lists[$k]['alt'] = $P[$v['pid']]['title'];
$lists[$k]['title'] = set_style($P[$v['pid']]['title'], $P[$v['pid']]['style']);
}
}
}
return $lists;
}
示例4: get_list
function get_list($condition = '1', $order = 'addtime DESC')
{
global $MOD, $pages, $page, $pagesize, $offset, $sum;
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}");
$items = $r['num'];
}
$pages = pages($items, $page, $pagesize);
if ($items < 1) {
return array();
}
$lists = array();
$result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}");
while ($r = $this->db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
$r['title'] = set_style($r['title'], $r['style']);
$r['linkurl'] = $MOD['linkurl'] . rewrite('expert.php?itemid=' . $r['itemid']);
$r['rate'] = $r['answer'] && $r['best'] < $r['answer'] ? dround($r['best'] * 100 / $r['answer'], 2, true) . '%' : '100%';
$lists[] = $r;
}
return $lists;
}
示例5: main
protected function main()
{
inc_lib('news/news_exists');
$count_news_existe = news_exists($_GET['id']);
if ($count_news_existe == false && (is_logged_in() && !check_auth('view_histo_all_news'))) {
redir(Nw::$lang['news']['news_not_exist'], false, './');
}
inc_lib('news/get_info_news');
$donnees_news = get_info_news($_GET['id']);
$this->set_title(Nw::$lang['news']['historique_news'] . ' | ' . $donnees_news['n_titre']);
$this->set_tpl('news/log_news.html');
$this->add_css('code.css');
// Fil ariane
if ($count_news_existe) {
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_news['c_nom'] => array($donnees_news['c_rewrite'] . '/'), $donnees_news['n_titre'] => array($donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['historique_news'] => array('')));
} else {
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['historique_news'] => array('')));
}
/**
* Affichage du logo
**/
inc_lib('news/get_news_logs');
$donnees_logs = get_news_logs('l_id_news = ' . intval($_GET['id']), 'l_date DESC');
foreach ($donnees_logs as $donnees) {
Nw::$tpl->setBlock('log', array('ACTION' => $donnees['l_action'], 'ACTION_LOG' => isset(Nw::$lang['news']['log_news_' . $donnees['l_action']]) ? Nw::$lang['news']['log_news_' . $donnees['l_action']] : '', 'TEXTE' => nl2br($donnees['l_texte']), 'TITRE' => $donnees['l_titre'], 'DATE' => date_sql($donnees['date'], $donnees['heures_date'], $donnees['jours_date']), 'AUTEUR' => $donnees['u_pseudo'], 'AUTEUR_ID' => $donnees['u_id'], 'AUTEUR_AVATAR' => $donnees['u_avatar'], 'AUTEUR_ALIAS' => $donnees['u_alias'], 'IP' => long2ip($donnees['l_ip'])));
}
Nw::$tpl->set(array('ID' => $_GET['id'], 'TITRE' => $donnees_news['n_titre']));
}
示例6: main
protected function main()
{
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: news-70.html');
}
inc_lib('news/news_exists');
if (news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html');
}
inc_lib('news/get_info_news');
$donnees_news = get_info_news($_GET['id']);
// Ce membre a le droit d'éditer la news ?
if ($donnees_news['n_etat'] != 3 && !is_logged_in()) {
redir(Nw::$lang['news']['not_view_news_perm'], false, './');
}
$this->set_tpl('mobile/news/view_news.html');
$this->load_lang_file('news');
inc_lib('news/has_voted_news');
Nw::$tpl->set(array('ID' => $_GET['id'], 'ETAT' => $donnees_news['n_etat'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'COMS' => $donnees_news['n_nbr_coms'], 'NB_VOT_VALID' => Nw::$pref['nb_votes_valid_news'], 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'SOURCE' => !empty($donnees_news['n_src_url']) ? $donnees_news['n_src_url'] : '', 'SOURCE_NOM' => !empty($donnees_news['n_src_nom']) ? $donnees_news['n_src_nom'] : '', 'TITRE' => $donnees_news['n_titre'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'CONTENU' => $donnees_news['v_texte'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0));
// Màj du nombre de visualisations
inc_lib('news/update_pg_vues');
update_pg_vues($_GET['id']);
Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX']));
}
示例7: main
protected function main()
{
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: news-70.html');
}
inc_lib('news/news_exists');
if (news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html');
}
inc_lib('news/get_info_news');
$info_news = get_info_news($_GET['id']);
if (!is_logged_in()) {
redir(Nw::$lang['news']['error_cant_alert'], false, './');
}
//Si on a envoyé des erreurs
if (!empty($_POST['contenu'])) {
inc_lib('news/add_alert_news');
add_alert_news(Nw::$dn_mbr['u_id'], $_GET['id'], $_POST['contenu'], $_POST['motif']);
redir(Nw::$lang['news']['confirm_alert'], true, $info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/');
}
$this->set_title($info_news['n_titre'] . ' | ' . $info_news['c_nom']);
$this->set_tpl('news/alert.html');
$this->add_css('forms.css');
$this->add_css('code.css');
$this->add_js('write.js');
$this->add_js('forms.js');
$this->add_form('contenu');
Nw::$tpl->set('ID', $info_news['n_id']);
inc_lib('bbcode/clearer');
Nw::$tpl->set(array('ID' => $_GET['id'], 'BAL_CHAMP' => 'contenu', 'NEWS' => $info_news['n_titre'], 'RESUME' => CoupeChar(clearer($info_news['v_texte'])), 'CAT_REWRITE' => $info_news['c_rewrite'], 'REWRITE' => rewrite($info_news['n_titre'])));
// Fil ariane
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $info_news['c_nom'] => array($info_news['c_rewrite'] . '/'), $info_news['n_titre'] => array($info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['alert'] => array('')));
}
示例8: main
protected function main()
{
$this->set_tpl('mobile/news/une.html');
$this->load_lang_file('news');
// On compte le nbr de news publiées
inc_lib('news/count_news');
$nombre_news = count_news('n_etat = 3');
$ids_all_news = array();
// Pagination
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_homepage']);
// On vérifie que la page existe bien
if ($nombreDePages > 0 && $page > $nombreDePages) {
redir(Nw::$lang['common']['pg_not_exist'], false, './');
}
// On recherche toutes les news publiées
inc_lib('news/get_list_news');
$list_dn_news = get_list_news('n_etat = 3', 'n_date DESC', $page, Nw::$pref['nb_news_homepage']);
$cours_news = 0;
foreach ($list_dn_news as $donnees_news) {
Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => rewrite($donnees_news['c_nom']), 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : '')));
++$cours_news;
}
Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $cours_news, 'INC_HEAD' => empty($_SERVER['HTTP_AJAX'])));
}
示例9: main
protected function main()
{
$this->set_title(Nw::$lang['news']['titre_pg_nuage_tags']);
$this->set_tpl('news/tags.html');
// Fil ariane
$this->set_filAriane(array(Nw::$lang['news']['titre_pg_nuage_tags'] => array('')));
/**
* Nuage de tags
**/
inc_lib('news/nuage_tags');
$list_count_by_cat = array();
$int_cats = array();
$nuage_tags = nuage_tags();
$nbr_tags = 0;
foreach ($nuage_tags as $donnees_tags) {
if (!isset($list_count_by_cat[$donnees_tags['n_id_cat']])) {
$list_count_by_cat[$donnees_tags['n_id_cat']] = 0;
}
$list_count_by_cat[$donnees_tags['n_id_cat']] = $list_count_by_cat[$donnees_tags['n_id_cat']] + 1;
$int_cats[$donnees_tags['n_id_cat']] = array($donnees_tags['c_nom'], $donnees_tags['c_couleur']);
++$nbr_tags;
Nw::$tpl->setBlock('nuage', array('INT' => $donnees_tags['t_tag'], 'REWRITE' => urlencode($donnees_tags['t_tag']), 'SIZE' => $donnees_tags['size'], 'COLOR' => $donnees_tags['c_couleur']));
}
foreach ($list_count_by_cat as $idc => $dn_stats) {
$int_nbr_tags = $dn_stats > 1 ? Nw::$lang['news']['nbr_tags'] : Nw::$lang['news']['nbr_tag'];
Nw::$tpl->setBlock('stats', array('CAT_ID' => $idc, 'CAT_NOM' => $int_cats[$idc][0], 'CAT_COLOR' => $int_cats[$idc][1], 'CAT_REWRITE' => rewrite($int_cats[$idc][0]), 'NBR_TAGS' => sprintf($int_nbr_tags, $dn_stats), 'PX' => round($dn_stats / $nbr_tags * 100)));
}
inc_lib('news/get_list_actifs_bycategorie');
Nw::$tpl->set(array('ID' => '', 'TOP_ACTIF' => get_list_actifs_bycategorie()));
}
示例10: get_list
function get_list($condition = 'status=3', $order = 'addtime DESC', $cache = '')
{
global $MOD, $pages, $page, $pagesize, $offset, $items, $TYPE, $special, $sum;
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}", $cache);
$items = $r['num'];
}
$pages = pages($items, $page, $pagesize);
if ($items < 1) {
return array();
}
$lists = array();
$result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}", $cache);
while ($r = $this->db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
$r['alt'] = $r['title'];
$r['title'] = set_style($r['title'], $r['style']);
$r['type'] = $r['typeid'] && isset($TYPE[$r['typeid']]) ? set_style($TYPE[$r['typeid']]['typename'], $TYPE[$r['typeid']]['style']) : '';
$r['typeurl'] = $r['type'] ? rewrite($MOD['linkurl'] . 'type.php?tid=' . $r['typeid']) : '';
$lists[] = $r;
}
return $lists;
}
示例11: Main
function Main()
{
$pid = get('pid');
$pid || $pid = post('pid');
$pid || exit($this->Ends());
preg_match('/^[a-z0-9]+$/i', $pid) || exit($this->Ends());
$payment = logic('pay')->GetOne($pid);
$payment || exit($this->Ends());
$status = logic('pay')->Verify($payment);
$status || exit($this->Ends());
$trade = logic('pay')->TradeData($payment);
$trade || exit($this->Ends());
if ($payment['code'] == 'alipay' || $payment['code'] == 'tenpay')
{
if (ini('payment.lp.enabled'))
{
if (MEMBER_ID)
{
header('Location: '.rewrite('index.php?mod=buy&code=order&op=process&sign='.$trade['sign']));
exit;
}
}
}
$parserAPI = logic('callback')->Parser($trade);
$parserAPI->MasterIframe($this);
preg_match('/^[a-z_]+$/i', $status) || exit($this->Ends());
$code = 'Parse_'.$status;
method_exists($parserAPI, $code) || exit($this->Ends());
$parserAPI->$code($payment);
}
示例12: main
protected function main()
{
// Seuls les membres peuvent créer des brouillons
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: ./');
}
// Le commentaire n'existe pas
inc_lib('news/cmt_news_exists');
if (cmt_news_exists($_GET['id']) == false) {
redir(Nw::$lang['news']['cmt_not_exist'], false, './');
}
inc_lib('news/get_info_cmt_news');
inc_lib('news/add_vote_cmt');
$donnees_cmt = get_info_cmt_news($_GET['id']);
$response = add_vote_cmt($_GET['id']);
inc_lib('news/get_info_news');
$donnees_news = get_info_news($donnees_cmt['c_id_news']);
$rewrite_news = $donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $donnees_news['n_id'] . '/';
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . $rewrite_news) === false) {
$_SESSION['nw_referer_edit'] = $_SERVER['HTTP_REFERER'];
}
// Vote bien ajouté
if ($response) {
$text_redir = Nw::$lang['news']['vote_cmt_ok'];
} else {
$text_redir = Nw::$lang['news']['vote_cmt_pasok'];
}
$link_redir = !empty($_SESSION['nw_referer_edit']) ? $_SESSION['nw_referer_edit'] : $rewrite_news;
redir($text_redir, true, $link_redir);
}
示例13: post_twitt_news
function post_twitt_news($id_news)
{
if (Nw::$is_prod && isset(Nw::$twitter['nouweo']) && count(Nw::$twitter['nouweo']) > 0) {
inc_lib('news/get_info_news');
$donnees_news = get_info_news($id_news);
$real_link_news = Nw::$site_url . $donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $id_news . '/';
$fields = array('source' => $real_link_news);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://shr.im/api/post/');
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
curl_close($curl);
$end_twitt = ' http://shr.im/' . $result . ' #' . strtolower(Nw::$site_name) . ' #' . strtolower($donnees_news['c_rewrite']);
$longueur_twitt = 145 - strlen($end_twitt);
if ($donnees_news['n_titre'] > $longueur_twitt) {
$add_titre = CoupeChar($donnees_news['n_titre'], '...', $longueur_twitt);
} else {
$add_titre = $donnees_news['n_titre'];
}
$twitt2post = $add_titre . $end_twitt;
// Postage du twitt sur le compte de base
$to = new TwitterOAuth(Nw::$twitter['nouweo']['consumer_key'], Nw::$twitter['nouweo']['consumer_secret'], Nw::$twitter['nouweo']['token'], Nw::$twitter['nouweo']['token_secret']);
$to->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $twitt2post), 'POST');
return $result;
} else {
return false;
}
}
示例14: add_mbr
function add_mbr($pseudo, $password, $email, $identifier = '', $valide = 0)
{
$bf_token = 'jJ_=éZAç1l';
$ft_token = 'ù%*àè1ç0°dezf';
$key_alea_code_activate = md5(uniqid(mt_rand()));
// Enregistrement de l'utilisateur dans la base de données
Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members (u_pseudo, u_alias, u_identifier, u_password, u_email, u_group, u_date_register, u_active, u_code_act, u_ip)
VALUES(\'' . insertBD(trim($pseudo)) . '\', \'' . rewrite(trim($pseudo)) . '\', \'' . insertBD(trim($identifier)) . '\', \'' . insertBD(sha1($bf_token . trim($password) . $ft_token)) . '\', \'' . insertBD(trim($email)) . '\',
4, NOW(), ' . intval($valide) . ', \'' . insertBD($key_alea_code_activate) . '\', \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
$id_new_membre = Nw::$DB->insert_id;
$identifiant_unique = md5($id_new_membre . uniqid(rand(), true));
$lien_activation = Nw::$site_url . 'users-32.html?mid=' . $id_new_membre . '&ca=' . $key_alea_code_activate;
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members SET u_ident_unique = \'' . Nw::$DB->real_escape_string($identifiant_unique) . '\' WHERE u_id = ' . intval($id_new_membre)) or Nw::$DB->trigger(__LINE__, __FILE__);
Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members_stats (s_id_membre) VALUES(' . intval($id_new_membre) . ')') or Nw::$DB->trigger(__LINE__, __FILE__);
inc_lib('users/mail2gd');
mail2gd($identifiant_unique, trim($email));
inc_lib('newsletter/add_abonnement');
add_abonnement(trim($email), $id_new_membre);
// Envoie d'email de validation
if ($valide == 0) {
$txt_mail = sprintf(Nw::$lang['users']['mail_confirm_insc'], $pseudo, Nw::$site_url, Nw::$site_name, $lien_activation, $lien_activation, $lien_activation);
@envoi_mail(trim($email), sprintf(Nw::$lang['users']['confirm_inscription'], Nw::$site_name), $txt_mail);
} else {
// Le compte est confirmé, on met à jour le nbr de membres
inc_lib('admin/gen_cachefile_nb_members');
gen_cachefile_nb_members();
generate_members_sitemap();
}
return $id_new_membre;
}
示例15: main
protected function main()
{
// Si le paramètre ID manque
if (empty($_GET['id'])) {
header('Location: ./');
}
inc_lib('users/mbr_exists');
if (mbr_exists($_GET['id']) == false) {
redir(Nw::$lang['users']['mbr_dont_exist'], false, 'users.html');
}
inc_lib('users/get_info_mbr');
$donnees_profile = get_info_mbr($_GET['id']);
$this->load_lang_file('users');
$this->load_lang_file('news');
$this->add_wid_in_content('view_profile.' . $donnees_profile['u_id']);
$this->set_tpl('profile/list_comments.html');
$this->set_title(sprintf(Nw::$lang['profile']['profile_title'], $donnees_profile['u_pseudo']));
$this->add_css('code.css');
$this->add_js('profil.js');
$this->set_filAriane(array(Nw::$lang['users']['members_section'] => array('users.html'), $donnees_profile['u_pseudo'] => array('./profile/' . $donnees_profile['u_alias'] . '/'), Nw::$lang['profile']['title_cmts_author'] => array('')));
$params_contrib = array();
$params_contrib[] = 'c_id_membre = ' . intval($_GET['id']);
if (!is_logged_in()) {
$params_contrib[] = 'n_etat = 3';
}
inc_lib('profile/count_comments_mbr');
$nombre_cmts = count_comments_mbr(implode(' AND ', $params_contrib));
// Pagination
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$nombreDePages = ceil($nombre_cmts / Nw::$pref['ppl_nb_comments']);
// On vérifie bien que la page existe
if ($nombreDePages > 0 && $page > $nombreDePages) {
redir(Nw::$lang['common']['pg_not_exist'], false, './');
}
inc_lib('profile/get_comments_mbr');
$com_cours = 0;
$list_cmts = get_comments_mbr(implode(' AND ', $params_contrib), 'c_date DESC', $page, Nw::$pref['ppl_nb_comments']);
foreach ($list_cmts as $donnees_cmts) {
++$com_cours;
$droit_edit = false;
$droit_delete = false;
if (is_logged_in()) {
$droit_edit = (bool) (Nw::$droits['can_edit_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_edit_all_comments'];
$droit_delete = (bool) (Nw::$droits['can_del_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_del_all_comments'];
}
$date_cmt = date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']);
$masque_motif = '';
if ($donnees_cmts['c_masque']) {
$date_cmt = sprintf(Nw::$lang['news']['del_cmt_with_reason'], strtolower(date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date'])));
if (!empty($donnees_cmts['c_masque_raison'])) {
$masque_motif = ' (' . sprintf(Nw::$lang['news']['motif_delete_cmt'], $donnees_cmts['c_masque_raison']) . ')';
}
}
Nw::$tpl->setBlock('cmt', array('ID' => $donnees_cmts['c_id'], 'ID_NEWS' => $donnees_cmts['c_id_news'], 'REWRITE' => rewrite($donnees_cmts['n_titre']), 'CAT_REWRITE' => $donnees_cmts['c_rewrite'], 'NUM' => ($page - 1) * Nw::$pref['nb_cmts_page'] + $com_cours, 'DATE' => $date_cmt, 'AVATAR' => $donnees_cmts['u_avatar'], 'LANG_AVATAR' => sprintf(Nw::$lang['news']['lang_avatar'], $donnees_cmts['u_pseudo']), 'AUTEUR' => $donnees_cmts['u_pseudo'], 'AUTEUR_ID' => $donnees_cmts['u_id'], 'AUTEUR_ALIAS' => $donnees_cmts['u_alias'], 'TEXTE' => $donnees_cmts['c_texte'], 'PLUSSOIE' => $donnees_cmts['c_plussoie'], 'GRP_TITRE' => $donnees_cmts['g_titre'], 'GRP_ICON' => $donnees_cmts['g_icone'], 'IP' => long2ip($donnees_cmts['c_ip']), 'MASQUE' => $donnees_cmts['c_masque'], 'MASQUE_MOTIF' => $masque_motif, 'EDIT' => $droit_edit, 'DELETE' => $droit_delete));
}
Nw::$tpl->set(array('NOMBRE_CMTS' => $nombre_cmts, 'LIST_PG' => list_pg($nombreDePages, $page, 'profile-135-' . $_GET['id'] . '%s.html')));
inc_lib('profile/assign_required_vars_profile');
assign_required_vars_profile($donnees_profile);
}