Example #1
0
/**
 * nv_theme_event_detail()
 *
 * @param mixed $array_data
 * @return
 */
function nv_theme_event_detail($array_data)
{
    global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op, $global_array_event_cat;
    if (NV_CURRENTTIME >= $array_data['start_time'] and NV_CURRENTTIME <= $array_data['end_time']) {
        $array_data['status_str'] = $lang_module['status_2'];
    } elseif (NV_CURRENTTIME < $array_data['start_time']) {
        $array_data['status_str'] = $lang_module['status_1'];
    } else {
        $array_data['status_str'] = $lang_module['status_0'];
    }
    $array_data['start_date'] = nv_date('d/m/Y', $array_data['start_time']);
    $array_data['start_time'] = nv_date('H:i', $array_data['start_time']);
    $array_data['end_date'] = nv_date('d/m/Y', $array_data['end_time']);
    $array_data['end_time'] = nv_date('H:i', $array_data['end_time']);
    $array_data['title_cat'] = $global_array_event_cat[$array_data['catid']]['title'];
    $array_data['url_cat'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_event_cat[$array_data['catid']]['alias'];
    $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('DATA', $array_data);
    if ($array_data['start_date'] == $array_data['end_date']) {
        $xtpl->parse('main.day');
    } else {
        $xtpl->parse('main.longday');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
 function nv_news_block_newscenter($block_config)
 {
     global $module_data, $module_name, $module_file, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
     $module_name = 'news';
     $module_data = 'news';
     $xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks');
     $xtpl->assign('lang', $lang_module);
     $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
     $db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(5);
     $list = nv_db_cache($db->sql(), 'id', $module_name);
     $i = 1;
     foreach ($list as $row) {
         $row['publtime'] = nv_date('m/d/Y', $row['publtime']);
         $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
         $row['title0'] = nv_clean60(strip_tags($row['title']), $i == 1 ? 50 : 30);
         $row['hometext'] = nv_clean60(strip_tags($row['hometext']), 260);
         $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
         if ($row['homeimgfile'] != '' and file_exists($image)) {
             if ($i == 1) {
                 $width = 570;
                 $height = 490;
             } else {
                 $width = 270;
                 $height = 230;
             }
             $row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
             $imginfo = nv_is_image($image);
             $basename = basename($image);
             if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
                 $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
                 if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
                     $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
                 } else {
                     require_once NV_ROOTDIR . '/includes/class/image.class.php';
                     $_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
                     $_image->cropFromCenter($width, $height);
                     $_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
                     if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
                         $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
                     }
                 }
             }
         } elseif (nv_is_url($row['homeimgfile'])) {
             $row['imgsource'] = $row['homeimgfile'];
         } elseif (!empty($module_config[$module_name]['show_no_image'])) {
             $row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
         } else {
             $row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png';
         }
         $xtpl->assign('main' . $i, $row);
         ++$i;
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
 /**
  * nv_others_product()
  *
  * @return
  */
 function nv_others_product($block_config)
 {
     global $op, $global_config, $pro_config;
     $module = $block_config['module'];
     if ($op == 'detail') {
         global $module_name, $lang_module, $module_info, $module_file, $global_array_shops_cat, $db, $module_data, $db_config, $id, $catid, $pro_config, $global_config;
         $xtpl = new XTemplate('block.others_product.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
         $xtpl->assign('LANG', $lang_module);
         $xtpl->assign('THEME_TEM', NV_BASE_SITEURL . 'themes/' . $module_info['template']);
         $xtpl->assign('WIDTH', $pro_config['blockwidth']);
         $db->sqlreset()->select('id, listcatid, ' . NV_LANG_DATA . '_title, ' . NV_LANG_DATA . '_alias ,addtime, homeimgfile, homeimgthumb, product_price, money_unit, discount_id, showprice')->from($db_config['prefix'] . '_' . $module_data . '_rows')->where('status =1 AND listcatid = ' . $catid . ' AND id < ' . $id)->order('id DESC')->limit(20);
         $result = $db->query($db->sql());
         $i = 1;
         while (list($id_i, $listcatid_i, $title_i, $alias_i, $addtime_i, $homeimgfile_i, $homeimgthumb_i, $product_price_i, $money_unit_i, $discount_id_i, $showprice_i) = $result->fetch(3)) {
             if ($homeimgthumb_i == 1) {
                 $src_img = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $homeimgfile_i;
             } elseif ($homeimgthumb_i == 2) {
                 $src_img = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $homeimgfile_i;
             } elseif ($homeimgthumb_i == 3) {
                 $src_img = $homeimgfile_i;
             } else {
                 $src_img = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/shops/no-image.jpg';
             }
             $xtpl->assign('link', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$listcatid_i]['alias'] . '/' . $alias_i . $global_config['rewrite_exturl']);
             $xtpl->assign('title', $title_i);
             $xtpl->assign('src_img', $src_img);
             $xtpl->assign('time', nv_date('d-m-Y h:i:s A', $addtime_i));
             if ($pro_config['active_price'] == '1') {
                 if ($showprice_i == '1') {
                     $price = nv_get_price($id_i, $money_unit_i);
                     $xtpl->assign('PRICE', $price);
                     if ($discount_id_i and $price['discount_percent'] > 0) {
                         $xtpl->parse('main.loop.price.discounts');
                     } else {
                         $xtpl->parse('main.loop.price.no_discounts');
                     }
                     $xtpl->parse('main.loop.price');
                 } else {
                     $xtpl->parse('main.loop.contact');
                 }
             }
             $bg = $i % 2 == 0 ? 'bg' : '';
             $xtpl->assign('bg', $bg);
             $xtpl->parse('main.loop');
             ++$i;
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Example #4
0
 function nv_bdown_news($block_config)
 {
     global $db, $module_info, $site_mods;
     $module = $block_config['module'];
     $file = $site_mods[$module]['module_file'];
     // Lay thong tin phan quyen
     $sql = "SELECT `id`, `alias`, `who_view`, `groups_view` FROM `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "_categories` WHERE `status`=1";
     $_tmp = nv_db_cache($sql, 'id', $module);
     $list_cat = array();
     if ($_tmp) {
         foreach ($_tmp as $row) {
             if (nv_set_allow($row['who_view'], $row['groups_view'])) {
                 $list_cat[$row['id']] = $row['alias'];
             }
         }
     }
     unset($_tmp, $sql);
     if ($list_cat) {
         $sql = "SELECT `id`, `catid`, `title`, `alias`, `updatetime` FROM `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "` WHERE `status` AND `catid` IN(" . implode(",", array_keys($list_cat)) . ") ORDER BY `updatetime` DESC LIMIT 0 , " . $block_config['numrow'];
         $list = nv_db_cache($sql, 'id', $module);
         if (!empty($list)) {
             if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $file . "/block_new_files.tpl")) {
                 $block_theme = $module_info['template'];
             } else {
                 $block_theme = "default";
             }
             $xtpl = new XTemplate("block_new_files.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $file);
             $xtpl->assign('CONFIG', $block_config);
             foreach ($list as $row) {
                 $row['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module . "&amp;" . NV_OP_VARIABLE . "=" . $list_cat[$row['catid']] . "/" . $row['alias'];
                 $row['updatetime'] = nv_date("d/m/Y", $row['updatetime']);
                 $row['stitle'] = nv_clean60($row['title'], $block_config['title_length']);
                 $xtpl->assign('ROW', $row);
                 if ($block_config['img_bullet']) {
                     $xtpl->parse('main.loop.bullet');
                 }
                 $xtpl->parse('main.loop');
             }
             $xtpl->parse('main');
             return $xtpl->text('main');
         }
     }
 }
 function nv_bdown_news($block_config)
 {
     global $db, $module_info, $site_mods, $global_config, $nv_Cache;
     $module = $block_config['module'];
     $file = $site_mods[$module]['module_file'];
     // Lay thong tin phan quyen
     $sql = 'SELECT id, alias, groups_view FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_categories WHERE status=1';
     $_tmp = $nv_Cache->db($sql, 'id', $module);
     $list_cat = array();
     if ($_tmp) {
         foreach ($_tmp as $row) {
             if (nv_user_in_groups($row['groups_view'])) {
                 $list_cat[$row['id']] = $row['alias'];
             }
         }
     }
     unset($_tmp, $sql);
     if ($list_cat) {
         $db->sqlreset()->select('id, catid, title, alias, updatetime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status AND catid IN (' . implode(',', array_keys($list_cat)) . ')')->order('updatetime DESC')->limit($block_config['numrow']);
         $list = $nv_Cache->db($db->sql(), 'id', $module);
         if (!empty($list)) {
             if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $file . '/block_new_files.tpl')) {
                 $block_theme = $global_config['module_theme'];
             } else {
                 $block_theme = 'default';
             }
             $xtpl = new XTemplate('block_new_files.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $file);
             $xtpl->assign('CONFIG', $block_config);
             foreach ($list as $row) {
                 $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $list_cat[$row['catid']] . '/' . $row['alias'] . $global_config['rewrite_exturl'];
                 $row['updatetime'] = nv_date('d/m/Y', $row['updatetime']);
                 $row['stitle'] = nv_clean60($row['title'], $block_config['title_length']);
                 $xtpl->assign('ROW', $row);
                 if ($block_config['img_bullet']) {
                     $xtpl->parse('main.loop.bullet');
                 }
                 $xtpl->parse('main.loop');
             }
             $xtpl->parse('main');
             return $xtpl->text('main');
         }
     }
 }
Example #6
0
/**
 * lost_pass_sendMail()
 *
 * @param mixed $row
 * @return void
 */
function lost_pass_sendMail($row)
{
    global $db, $global_config, $lang_module;
    $passlostkey = (!empty($row['passlostkey']) and preg_match("/^([0-9]{10,15})\\|([a-z0-9]{32})\$/i", $row['passlostkey'], $matches)) ? array($matches[1], $matches[2]) : array();
    if (!isset($passlostkey[0]) or !isset($passlostkey[1]) or (int) $passlostkey[0] < NV_CURRENTTIME) {
        $key = strtoupper(nv_genpass(10));
        $passlostkey = md5($row['userid'] . $key . $global_config['sitekey']);
        $pa = NV_CURRENTTIME + 3600;
        $passlostkey = $pa . '|' . $passlostkey;
        $sql = "UPDATE " . NV_MOD_TABLE . " SET passlostkey='" . $passlostkey . "' WHERE userid=" . $row['userid'];
        $db->query($sql);
        $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
        $name = array_filter($name);
        $name = implode(' ', $name);
        $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
        $message = sprintf($lang_module['lostpass_email_content'], $name, $sitename, $key, nv_date('H:i d/m/Y', $pa));
        @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['lostpass_email_subject'], $message);
    }
}
 function block_photo_detail($block_config)
 {
     global $data_album, $module_photo_cat, $lang_module, $op, $client_info, $site_mods, $module_info, $db, $module_config, $global_config, $my_head;
     if ($op == 'detail') {
         $module = $block_config['module'];
         $mod_data = $site_mods[$module]['module_data'];
         $mod_file = $site_mods[$module]['module_file'];
         if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/module.block_detail.tpl')) {
             $block_theme = $module_info['template'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('module.block_detail.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file . '/');
         $xtpl->assign('LANG', $lang_module);
         $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
         $xtpl->assign('TEMPLATE', $module_info['template']);
         $xtpl->assign('MODULE_FILE', $mod_file);
         $xtpl->assign('SELFURL', $client_info['selfurl']);
         $data_album['image'] = NV_MY_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/images/' . $data_album['file'];
         $data_album['thumb'] = NV_MY_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/thumb/' . $data_album['thumb'];
         // $my_head="<meta name=\"thumbnail\" content=\"".$data_album['thumb']."\"/>";
         // $my_head.="<!--";
         // $my_head.="  <PageMap>";
         // $my_head.="	<DataObject type=\"thumbnail\">";
         // $my_head.="	  <Attribute name=\"src\" value=\"http://dangdinhtu.com/uploads/photo/thumb/2015_01/90x72-148-copy.jpg\"/>";
         // $my_head.="	  <Attribute name=\"width\" value=\"100\"/>";
         // $my_head.="	  <Attribute name=\"height\" value=\"130\"/>";
         // $my_head.="	</DataObject>";
         // $my_head.="  </PageMap>";
         // $my_head.="-->";
         $ratingwidth = $data_album['total_rating'] > 0 ? $data_album['total_rating'] * 100 / ($data_album['click_rating'] * 5) * 0.01 : 0;
         $xtpl->assign('RATINGVALUE', $data_album['total_rating'] > 0 ? round($data_album['total_rating'] / $data_album['click_rating'], 1) : 0);
         $xtpl->assign('RATINGCOUNT', $data_album['click_rating']);
         $xtpl->assign('REVIEWCOUNT', $data_album['total_rating']);
         $xtpl->assign('RATINGWIDTH', round($ratingwidth, 2));
         $xtpl->assign('LINK_RATE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=rating&album_id=' . $data_album['album_id']);
         $data_album['capturedate'] = nv_date('d-m-Y', $data_album['capturedate']);
         $xtpl->assign('DATA', $data_album);
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
 function nv_comment_new($block_config)
 {
     global $db, $site_mods, $db_slave, $module_info, $global_config;
     $module = $block_config['module'];
     $mod_data = $site_mods[$module]['module_data'];
     $sql = "SELECT * FROM " . NV_PREFIXLANG . "_comment WHERE module = " . $db->quote($module) . " AND status=1 ORDER BY post_time DESC LIMIT " . $block_config['numrow'];
     $result = $db_slave->query($sql);
     $array_comment = array();
     $array_news_id = array();
     while ($comment = $result->fetch()) {
         $array_comment[] = $comment;
         $array_news_id[] = $comment['id'];
     }
     if (!empty($array_news_id)) {
         $result = $db_slave->query('SELECT t1.id, t1.alias AS alias_id, t2.alias AS alias_cat FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows t1 INNER JOIN ' . NV_PREFIXLANG . '_' . $mod_data . '_cat t2 ON t1.catid = t2.catid WHERE t1.id IN (' . implode(',', array_unique($array_news_id)) . ') AND status = 1');
         $array_news_id = array();
         while ($row = $result->fetch()) {
             $array_news_id[$row['id']] = $row;
         }
         $mod_file = $site_mods[$module]['module_file'];
         if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/block_new_comment.tpl')) {
             $block_theme = $module_info['template'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block_new_comment.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
         $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
         $xtpl->assign('TEMPLATE', $block_theme);
         foreach ($array_comment as $comment) {
             if (isset($array_news_id[$comment['id']])) {
                 $comment['url_comment'] = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $array_news_id[$comment['id']]['alias_cat'] . '/' . $array_news_id[$comment['id']]['alias_id'] . '-' . $comment['id'] . $global_config['rewrite_exturl'], true);
                 $comment['content'] = nv_clean60($comment['content'], $block_config['titlelength']);
                 $comment['post_time'] = nv_date('d/m/Y H:i', $comment['post_time']);
                 $xtpl->assign('COMMENT', $comment);
                 $xtpl->parse('main.loop');
             }
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
        $sth->bindValue(':q_blood_pressure', '%' . $q . '%');
    }
    $sth->execute();
    $num_items = $sth->fetchColumn();
    $db->select('*')->order('id DESC')->limit($per_page)->offset(($page - 1) * $per_page);
    $sth = $db->prepare($db->sql());
    if (!empty($q)) {
        $sth->bindValue(':q_card_code', '%' . $q . '%');
        $sth->bindValue(':q_dose', '%' . $q . '%');
        $sth->bindValue(':q_weight', '%' . $q . '%');
        $sth->bindValue(':q_pulse', '%' . $q . '%');
        $sth->bindValue(':q_blood_pressure', '%' . $q . '%');
    }
    $sth->execute();
}
$row['member']['birthday'] = !empty($row['member']['birthday']) ? nv_date('d/m/Y', $row['member']['birthday']) : '';
$xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
$xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('NV_ASSETS_DIR', NV_ASSETS_DIR);
$xtpl->assign('OP', $op);
$xtpl->assign('ROW', $row);
$xtpl->assign('Q', $q);
if ($show_view) {
    if (!empty($q)) {
Example #10
0
     $data_insert['md5username'] = nv_md5safe($array_register['username']);
     $data_insert['password'] = $password;
     $data_insert['email'] = $array_register['email'];
     $data_insert['first_name'] = $array_register['first_name'];
     $data_insert['last_name'] = $array_register['last_name'];
     $data_insert['your_question'] = $your_question;
     $data_insert['answer'] = $array_register['answer'];
     $data_insert['checknum'] = $checknum;
     $data_insert['users_info'] = nv_base64_encode(serialize($query_field));
     $userid = $db->insert_id($sql, 'userid', $data_insert);
     if (!$userid) {
         die(reg_result(array('status' => 'error', 'input' => '', 'mess' => $lang_module['err_no_save_account'])));
     } else {
         if ($global_config['allowuserreg'] == 2) {
             $subject = $lang_module['account_active'];
             $message = sprintf($lang_module['account_active_info'], $array_register['first_name'], $global_config['site_name'], NV_MY_DOMAIN . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=active&userid=' . $userid . '&checknum=' . $checknum, $array_register['username'], $array_register['email'], nv_date('H:i d/m/Y', NV_CURRENTTIME + 86400));
             $send = nv_sendmail($global_config['site_email'], $array_register['email'], $subject, $message);
             if ($send) {
                 $info = $lang_module['account_active_mess'];
             } else {
                 $info = $lang_module['account_active_mess_error_mail'];
             }
         } else {
             $info = $lang_module['account_register_to_admin'];
         }
         $nv_redirect = '';
         die(reg_result(array('status' => 'ok', 'input' => '', 'mess' => $info)));
     }
 } else {
     $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . "\n\t\t(username, md5username, password, email, first_name, last_name, gender, photo, birthday, regdate,\n\t\tquestion, answer, passlostkey, view_mail, remember, in_groups,\n\t\tactive, checknum, last_login, last_ip, last_agent, last_openid, idsite) VALUES (\n\t\t:username,\n\t\t:md5username,\n\t\t:password,\n\t\t:email,\n\t\t:first_name,\n\t\t:last_name,\n\t\t'', '', 0, " . NV_CURRENTTIME . ",\n\t\t:your_question,\n\t\t:answer,\n\t\t'', 0, 1, '', 1, '', 0, '', '', '', " . $global_config['idsite'] . ")";
     $data_insert = array();
Example #11
0
                        $xtpl->parse('extUpd.loop.updateNotLastest');
                    } else {
                        $xtpl->assign('UPDNOTE', sprintf($lang_module['extUpdNote3'], NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=extensions&amp;' . NV_OP_VARIABLE . '=update&amp;eid=' . $value['id'] . '&amp;fid=' . $updateVersion['fid'] . '&amp;checksess=' . md5($value['id'] . $updateVersion['fid'] . $global_config['sitekey'] . session_id())));
                        $xtpl->parse('extUpd.loop.updateLastest');
                    }
                } elseif (!$value['origin']) {
                    $note = $lang_module['extNote1'];
                    $icon = 'fa-exclamation-triangle text-danger';
                    $xtpl->parse('extUpd.loop.note2');
                } else {
                    $note = $lang_module['extNote5'];
                    $icon = 'fa-check text-success';
                }
                $xtpl->assign('EXTNOTE', $note);
                $xtpl->assign('EXTICON', $icon);
                $xtpl->parse('extUpd.loop');
                ++$a;
            }
            $xtpl->assign('EXTUPDDATE', nv_date('d/m/Y H:i', $extUpdDate));
            $xtpl->assign('LINKNEWEXT', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=extensions&amp;' . NV_OP_VARIABLE . '=newest');
            $xtpl->parse('extUpd');
            echo $xtpl->text('extUpd');
        }
    }
    die;
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Example #12
0
         $array_order_new[$key] = $link;
     }
 }
 $db->sqlreset()->select('COUNT(*)')->from(NV_USERS_GLOBALTABLE)->where('active=1');
 $num_items = $db->query($db->sql())->fetchColumn();
 $db->select('userid, username, md5username, first_name, last_name, photo, gender, regdate')->order($orderby . ' ' . $sortby)->limit($per_page)->offset(($page - 1) * $per_page);
 $result = $db->query($db->sql());
 $users_array = array();
 while ($item = $result->fetch()) {
     $item['full_name'] = nv_show_name_user($item['first_name'], $item['last_name']);
     if (!empty($item['photo']) and file_exists(NV_ROOTDIR . '/' . $item['photo'])) {
         $item['photo'] = NV_BASE_SITEURL . $item['photo'];
     } else {
         $item['photo'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/no_avatar.png';
     }
     $item['regdate'] = nv_date('d/m/Y', $item['regdate']);
     $item['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=memberlist/' . change_alias($item['username']) . '-' . $item['md5username'];
     $item['gender'] = $item['gender'] == 'M' ? $lang_module['male'] : ($item['gender'] == 'F' ? $lang_module['female'] : $lang_module['na']);
     $users_array[$item['userid']] = $item;
 }
 $result->closeCursor();
 // Khong cho dat trang tuy tien
 if (empty($users_array) and $page > 0) {
     Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
     exit;
 }
 // Them vao tieu de trang
 if (!empty($orderby)) {
     $page_title .= ' ' . sprintf($lang_module['listusers_sort_by'], $lang_module['listusers_sort_by_' . $orderby], $lang_module['listusers_order_' . $sortby]);
 }
 // Tieu de khi phan trang
Example #13
0
        $admins[$row['admin_id']]['thead'] = $thead;
        $admins[$row['admin_id']]['options'] = array();
        $admins[$row['admin_id']]['options']['login'] = array($lang_module['login'], $login);
        $admins[$row['admin_id']]['options']['email'] = array($lang_module['email'], $email);
        $admins[$row['admin_id']]['options']['full_name'] = array($lang_module['name'], $row['full_name']);
        $admins[$row['admin_id']]['options']['lev'] = array($lang_module['lev'], $level_txt);
        $admins[$row['admin_id']]['options']['lev'] = array($lang_module['lev'], $level_txt);
        $admins[$row['admin_id']]['options']['position'] = array($lang_module['position'], $row['position']);
        $admins[$row['admin_id']]['options']['is_suspend'] = array($lang_module['is_suspend'], $is_suspend, $row['is_suspend']);
        if (defined('NV_IS_SPADMIN')) {
            $admins[$row['admin_id']]['options']['editor'] = array($lang_module['editor'], !empty($row['editor']) ? $row['editor'] : $lang_module['not_use']);
            $admins[$row['admin_id']]['options']['allow_files_type'] = array($lang_module['allow_files_type'], !empty($allow_files_type) ? implode(', ', $allow_files_type) : $lang_global['no']);
            $admins[$row['admin_id']]['options']['allow_modify_files'] = array($lang_module['allow_modify_files'], !empty($allow_modify_files) ? $lang_global['yes'] : $lang_global['no']);
            $admins[$row['admin_id']]['options']['allow_create_subdirectories'] = array($lang_module['allow_create_subdirectories'], !empty($allow_create_subdirectories) ? $lang_global['yes'] : $lang_global['no']);
            $admins[$row['admin_id']]['options']['allow_modify_subdirectories'] = array($lang_module['allow_modify_subdirectories'], !empty($allow_modify_subdirectories) ? $lang_global['yes'] : $lang_global['no']);
            $admins[$row['admin_id']]['options']['regtime'] = array($lang_module['regtime'], nv_date('l, d/m/Y H:i', $row['regdate']));
            $admins[$row['admin_id']]['options']['last_login'] = array($lang_module['last_login'], $last_login);
            $admins[$row['admin_id']]['options']['last_ip'] = array($lang_module['last_ip'], $row['last_ip']);
            $admins[$row['admin_id']]['options']['browser'] = array($lang_module['browser'], $browser['name']);
            $admins[$row['admin_id']]['options']['os'] = array($lang_module['os'], $os['name']);
        }
    }
}
if (!empty($admins)) {
    if ($global_config['authors_detail_main'] or $numrows == 1) {
        $xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
        foreach ($admins as $id => $values) {
            $xtpl->assign('ID', $id);
            $xtpl->assign('CAPTION', $values['caption']);
            if (!empty($values['thead']['edit'])) {
                $xtpl->assign('EDIT_HREF', $values['thead']['edit'][0]);
Example #14
0
function nv_admin_theme($contents, $head_site = 1)
{
    global $global_config, $lang_global, $admin_mods, $site_mods, $admin_menu_mods, $module_name, $module_file, $module_info, $admin_info, $db, $page_title, $submenu, $select_options, $op, $set_active_op, $array_lang_admin, $my_head, $my_footer, $array_mod_title, $array_url_instruction, $op, $client_info;
    $dir_template = '';
    if ($head_site == 1) {
        $file_name_tpl = 'main.tpl';
        if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system/' . $file_name_tpl)) {
            $dir_template = NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system';
        } else {
            $dir_template = NV_ROOTDIR . '/themes/admin_default/system';
            $global_config['admin_theme'] = 'admin_default';
        }
    } else {
        $file_name_tpl = 'content.tpl';
        if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system/' . $file_name_tpl)) {
            $dir_template = NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system';
        } else {
            $dir_template = NV_ROOTDIR . '/themes/admin_default/system';
            $global_config['admin_theme'] = 'admin_default';
        }
    }
    $global_config['site_name'] = empty($global_config['site_name']) ? NV_SERVER_NAME : $global_config['site_name'];
    $xtpl = new XTemplate($file_name_tpl, $dir_template);
    $xtpl->assign('NV_SITE_COPYRIGHT', $global_config['site_name'] . ' [' . $global_config['site_email'] . '] ');
    $xtpl->assign('NV_SITE_NAME', $global_config['site_name']);
    $xtpl->assign('NV_SITE_TITLE', $global_config['site_name'] . ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['admin_page'] . ' ' . NV_TITLEBAR_DEFIS . ' ' . $module_info['custom_title']);
    $xtpl->assign('SITE_DESCRIPTION', $global_config['site_description']);
    $xtpl->assign('NV_CHECK_PASS_MSTIME', (intval($global_config['admin_check_pass_time']) - 62) * 1000);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('NV_ADMINDIR', NV_ADMINDIR);
    $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
    $xtpl->assign('NV_ASSETS_DIR', NV_ASSETS_DIR);
    $xtpl->assign('MODULE_NAME', $module_name);
    $xtpl->assign('MODULE_FILE', $module_file);
    $xtpl->assign('NV_ADMIN_THEME', $global_config['admin_theme']);
    $xtpl->assign('LANG', $lang_global);
    if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/css/' . $module_file . '.css')) {
        $xtpl->assign('NV_CSS_MODULE_THEME', NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/css/' . $module_file . '.css');
        $xtpl->parse('main.css_module');
    } elseif (file_exists(NV_ROOTDIR . '/themes/admin_default/css/' . $module_file . '.css')) {
        $xtpl->assign('NV_CSS_MODULE_THEME', NV_BASE_SITEURL . 'themes/admin_default/css/' . $module_file . '.css');
        $xtpl->parse('main.css_module');
    }
    $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
    $xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE);
    $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
    $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
    $xtpl->assign('NV_SITE_TIMEZONE_OFFSET', round(NV_SITE_TIMEZONE_OFFSET / 3600));
    $xtpl->assign('NV_CURRENTTIME', nv_date('T', NV_CURRENTTIME));
    $xtpl->assign('NV_COOKIE_PREFIX', $global_config['cookie_prefix']);
    if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/js/' . $module_file . '.js')) {
        $xtpl->assign('NV_JS_MODULE', NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/js/' . $module_file . '.js');
        $xtpl->parse('main.module_js');
    }
    if (defined('NV_EDITOR') and nv_function_exists('nv_add_editor_js')) {
        $xtpl->assign('NV_ADD_EDITOR_JS', nv_add_editor_js());
        $xtpl->parse('main.nv_add_editor_js');
    }
    if ($head_site == 1) {
        $xtpl->assign('NV_GO_CLIENTSECTOR', $lang_global['go_clientsector']);
        $lang_site = !empty($site_mods) ? NV_LANG_DATA : $global_config['site_lang'];
        $xtpl->assign('NV_GO_CLIENTSECTOR_URL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_site);
        $xtpl->assign('NV_LOGOUT', $lang_global['admin_logout_title']);
        if (!empty($array_lang_admin)) {
            $xtpl->assign('NV_LANGDATA', $lang_global['langdata']);
            $xtpl->assign('NV_LANGDATA_CURRENT', $array_lang_admin[NV_LANG_DATA]);
            foreach ($array_lang_admin as $lang_i => $lang_name) {
                $xtpl->assign('DISABLED', $lang_i == NV_LANG_DATA ? " class=\"disabled\"" : "");
                $xtpl->assign('LANGVALUE', $lang_name);
                $xtpl->assign('LANGOP', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_i);
                $xtpl->parse('main.langdata.option');
            }
            $xtpl->parse('main.langdata');
        }
        // Top_menu
        $top_menu = $admin_mods;
        if (sizeof($top_menu) > 8) {
            if ($module_name != 'authors') {
                unset($top_menu['authors']);
            }
            if ($module_name != 'language') {
                unset($top_menu['language']);
            }
        }
        foreach ($top_menu as $m => $v) {
            if (!empty($v['custom_title'])) {
                $array_submenu = nv_get_submenu($m);
                $xtpl->assign('TOP_MENU_CLASS', $array_submenu ? ' class="dropdown"' : '');
                $xtpl->assign('TOP_MENU_HREF', $m);
                $xtpl->assign('TOP_MENU_NAME', $v['custom_title']);
                if (!empty($array_submenu)) {
                    $xtpl->parse('main.top_menu_loop.has_sub');
                    foreach ($array_submenu as $mop => $submenu_i) {
                        $xtpl->assign('SUBMENULINK', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $m . '&amp;' . NV_OP_VARIABLE . '=' . $mop);
                        $xtpl->assign('SUBMENUTITLE', $submenu_i);
                        $xtpl->parse('main.top_menu_loop.submenu.submenu_loop');
                    }
                    $xtpl->parse('main.top_menu_loop.submenu');
                }
                $xtpl->parse('main.top_menu_loop');
            }
        }
        $xtpl->parse('main.top_menu');
        $xtpl->assign('NV_DIGCLOCK', nv_date('H:i T l, d/m/Y', NV_CURRENTTIME));
        if ($admin_info['current_login'] >= NV_CURRENTTIME - 60) {
            if (!empty($admin_info['last_login'])) {
                $temp = sprintf($lang_global['hello_admin1'], $admin_info['username'], date('H:i d/m/Y', $admin_info['last_login']), $admin_info['last_ip']);
                $xtpl->assign('HELLO_ADMIN1', $temp);
                $xtpl->parse('main.hello_admin');
            } else {
                $temp = sprintf($lang_global['hello_admin3'], $admin_info['username']);
                $xtpl->assign('HELLO_ADMIN3', $temp);
                $xtpl->parse('main.hello_admin3');
            }
        } else {
            $temp = sprintf($lang_global['hello_admin2'], $admin_info['username'], nv_convertfromSec(NV_CURRENTTIME - $admin_info['current_login']), $admin_info['current_ip']);
            $xtpl->assign('HELLO_ADMIN2', $temp);
            $xtpl->parse('main.hello_admin2');
        }
        // Admin photo
        $xtpl->assign('ADMIN_USERNAME', $admin_info['username']);
        if (!empty($admin_info['photo']) and file_exists(NV_ROOTDIR . '/' . $admin_info['photo'])) {
            $xtpl->assign('ADMIN_PHOTO', NV_BASE_SITEURL . $admin_info['photo']);
        } else {
            $xtpl->assign('ADMIN_PHOTO', NV_BASE_SITEURL . 'themes/default/images/users/no_avatar.png');
        }
        // Vertical menu
        foreach ($admin_menu_mods as $m => $v) {
            $xtpl->assign('MENU_CLASS', $module_name == $m ? ' class="active"' : '');
            $xtpl->assign('MENU_HREF', $m);
            $xtpl->assign('MENU_NAME', $v);
            if ($m != $module_name) {
                $submenu = nv_get_submenu_mod($m);
                $xtpl->assign('MENU_CLASS', $submenu ? ' class="dropdown"' : '');
                if (!empty($submenu)) {
                    foreach ($submenu as $n => $l) {
                        $xtpl->assign('MENU_SUB_HREF', $m);
                        $xtpl->assign('MENU_SUB_OP', $n);
                        $xtpl->assign('MENU_SUB_NAME', (is_array($l) and isset($l['title'])) ? $l['title'] : $l);
                        $xtpl->parse('main.menu_loop.submenu.loop');
                    }
                    $xtpl->parse('main.menu_loop.submenu');
                }
            } elseif (!empty($submenu)) {
                foreach ($submenu as $n => $l) {
                    if (is_array($l) and isset($l['submenu'])) {
                        $_subtitle = $l['title'];
                        $_submenu_i = $l['submenu'];
                    } else {
                        $_subtitle = $l;
                        $_submenu_i = '';
                    }
                    $xtpl->assign('MENU_SUB_CURRENT', (!empty($op) and $op == $n or !empty($set_active_op) and $set_active_op == $n) ? 'subactive' : 'subcurrent');
                    $xtpl->assign('MENU_SUB_HREF', $m);
                    $xtpl->assign('MENU_SUB_OP', $n);
                    $xtpl->assign('MENU_SUB_NAME', $_subtitle);
                    $xtpl->assign('MENU_CLASS', '');
                    if (!empty($_submenu_i)) {
                        $xtpl->assign('MENU_CLASS', ' class="dropdown"');
                        foreach ($_submenu_i as $sn => $sl) {
                            $xtpl->assign('CUR_SUB_OP', $sn);
                            $xtpl->assign('CUR_SUB_NAME', $sl);
                            $xtpl->parse('main.menu_loop.current.submenu.loop');
                        }
                        $xtpl->parse('main.menu_loop.current.submenu');
                    }
                    $xtpl->parse('main.menu_loop.current');
                }
            }
            $xtpl->parse('main.menu_loop');
        }
        // Notification icon
        if ($global_config['notification_active']) {
            $xtpl->parse('main.notification');
            $xtpl->parse('main.notification_js');
        }
    }
    if (!empty($select_options)) {
        $xtpl->assign('PLEASE_SELECT', $lang_global['please_select']);
        foreach ($select_options as $value => $link) {
            $xtpl->assign('SELECT_NAME', $link);
            $xtpl->assign('SELECT_VALUE', $value);
            $xtpl->parse('main.select_option.select_option_loop');
        }
        $xtpl->parse('main.select_option');
    } elseif (isset($site_mods[$module_name]['main_file']) and $site_mods[$module_name]['main_file']) {
        $xtpl->assign('NV_GO_CLIENTMOD', $lang_global['go_clientmod']);
        $xtpl->parse('main.site_mods');
    }
    if (!empty($array_url_instruction)) {
        foreach ($array_url_instruction as $key => $value) {
            if ($op == $key and filter_var($value, FILTER_VALIDATE_URL)) {
                $xtpl->assign('NV_INSTRUCTION', $lang_global['go_instrucion']);
                $xtpl->assign('NV_URL_INSTRUCTION', $value);
                $xtpl->parse('main.url_instruction');
                break;
            }
        }
    }
    /**
     * Breadcrumbs
     * Note: If active is true, the link will be dismiss
     * If empty $array_mod_title and $page_title, breadcrumbs do not display
     * By default, breadcrumbs is $page_title
     */
    if (empty($array_mod_title) and !empty($page_title)) {
        $array_mod_title = array(0 => array('title' => $page_title, 'link' => '', 'active' => true));
    }
    if (!empty($array_mod_title)) {
        foreach ($array_mod_title as $breadcrumbs) {
            $xtpl->assign('BREADCRUMBS', $breadcrumbs);
            if (!empty($breadcrumbs['active'])) {
                $xtpl->parse('main.breadcrumbs.loop.active');
            }
            if (!empty($breadcrumbs['link']) and empty($breadcrumbs['active'])) {
                $xtpl->parse('main.breadcrumbs.loop.linked');
            } else {
                $xtpl->parse('main.breadcrumbs.loop.text');
            }
            $xtpl->parse('main.breadcrumbs.loop');
        }
        $xtpl->parse('main.breadcrumbs');
    }
    $xtpl->assign('THEME_ERROR_INFO', nv_error_info());
    $xtpl->assign('MODULE_CONTENT', $contents);
    $xtpl->assign('NV_COPYRIGHT', sprintf($lang_global['copyright'], $global_config['site_name']));
    if (defined('CKEDITOR')) {
        $xtpl->parse('main.ckeditor');
    }
    if (defined('NV_IS_SPADMIN') and $admin_info['level'] == 1) {
        $xtpl->parse('main.memory_time_usage');
    }
    if ($client_info['browser']['key'] == 'explorer' and $client_info['browser']['version'] < 9) {
        $xtpl->parse('main.lt_ie9');
    }
    $xtpl->parse('main');
    $sitecontent = $xtpl->text('main');
    if (!empty($my_head)) {
        $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . "\\1", $sitecontent, 1);
    }
    if (!empty($my_footer)) {
        $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . "\\1", $sitecontent, 1);
    }
    return $sitecontent;
}
Example #15
0
        $base_url .= '&q=' . $q;
    }
    $generate_page = nv_generate_page($base_url, $num_items, $per_page, $page);
    if (!empty($generate_page)) {
        $xtpl->assign('NV_GENERATE_PAGE', $generate_page);
        $xtpl->parse('main.view.generate_page');
    }
    while ($view = $sth->fetch()) {
        if (NV_CURRENTTIME >= $view['date_start'] and (empty($view['uses_per_coupon']) or $view['uses_per_coupon_count'] < $view['uses_per_coupon']) and (empty($view['date_end']) or NV_CURRENTTIME < $view['date_end'])) {
            $view['status'] = $lang_module['coupons_active'];
        } else {
            $view['status'] = $lang_module['coupons_inactive'];
        }
        $view['discount_text'] = $view['type'] == 'p' ? '%' : ' ' . $pro_config['money_unit'];
        $view['date_start'] = empty($view['date_start']) ? '' : nv_date('d/m/Y', $view['date_start']);
        $view['date_end'] = empty($view['date_end']) ? '' : nv_date('d/m/Y', $view['date_end']);
        $view['link_view'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=coupons_view&amp;id=' . $view['id'];
        $view['link_edit'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;id=' . $view['id'];
        $view['link_delete'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;delete_id=' . $view['id'] . '&amp;delete_checkss=' . md5($view['id'] . NV_CACHE_PREFIX . $client_info['session_id']);
        $xtpl->assign('VIEW', $view);
        $xtpl->parse('main.view.loop');
    }
    $xtpl->parse('main.view');
}
if (!empty($error)) {
    $xtpl->assign('ERROR', implode('<br />', $error));
    $xtpl->parse('main.error');
}
$array_select_type = array('p' => $lang_module['coupons_type_percentage'], 'f' => $lang_module['coupons_type_fixed_amount']);
foreach ($array_select_type as $key => $title) {
    $xtpl->assign('OPTION', array('key' => $key, 'title' => $title, 'selected' => $key == $row['type'] ? ' selected="selected"' : ''));
/**
 * nv_html_site_js()
 *
 * @param bool $html
 * @return
 */
function nv_html_site_js($html = true)
{
    global $global_config, $module_info, $module_name, $module_file, $lang_global, $op, $client_info;
    $jsDef = "var nv_siteroot=\"" . NV_BASE_SITEURL . "\",nv_sitelang=\"" . NV_LANG_INTERFACE . "\",nv_name_variable=\"" . NV_NAME_VARIABLE . "\",nv_fc_variable=\"" . NV_OP_VARIABLE . "\",nv_lang_variable=\"" . NV_LANG_VARIABLE . "\",nv_module_name=\"" . $module_name . "\",nv_func_name=\"" . $op . "\",nv_is_user="******"NV_IS_USER") . ", nv_my_ofs=" . round(NV_SITE_TIMEZONE_OFFSET / 3600) . ",nv_my_abbr=\"" . nv_date("T", NV_CURRENTTIME) . "\",nv_cookie_prefix=\"" . $global_config['cookie_prefix'] . "\",nv_check_pass_mstime=" . (intval($global_config['user_check_pass_time']) - 62) * 1000 . ",nv_area_admin=0,theme_responsive=" . (int) ($global_config['current_theme_type'] == 'r');
    if (defined('NV_IS_DRAG_BLOCK')) {
        $jsDef .= ',drag_block=1,blockredirect="' . nv_base64_encode($client_info['selfurl']) . '",selfurl="' . $client_info['selfurl'] . '",block_delete_confirm="' . $lang_global['block_delete_confirm'] . '",block_outgroup_confirm="' . $lang_global['block_outgroup_confirm'] . '",blocks_saved="' . $lang_global['blocks_saved'] . '",blocks_saved_error="' . $lang_global['blocks_saved_error'] . '",post_url="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=themes&' . NV_OP_VARIABLE . '=",func_id=' . $module_info['funcs'][$op]['func_id'] . ',module_theme="' . $global_config['module_theme'] . '"';
    }
    $jsDef .= ";";
    $return = array();
    $return[] = array('ext' => 0, 'content' => $jsDef);
    $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/jquery/jquery.min.js");
    $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/language/" . NV_LANG_INTERFACE . ".js");
    $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/global.js");
    if (defined('NV_IS_ADMIN')) {
        $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/admin.js");
    }
    // module js
    if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/js/' . $module_file . '.js')) {
        $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/js/' . $module_file . '.js');
    }
    if (defined('NV_EDITOR') and nv_function_exists('nv_add_editor_js')) {
        $editor_js = nv_add_editor_js();
        preg_match("/src\\s*=\\s*[\"']([^\"']+)[\"']/i", $editor_js, $matches);
        $return[] = array('ext' => 1, 'content' => $matches[1]);
    }
    if (defined('NV_IS_DRAG_BLOCK')) {
        $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/ui/jquery.ui.core.min.js");
        $return[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/ui/jquery.ui.sortable.min.js");
    }
    if (!$html) {
        return $return;
    }
    $res = "";
    foreach ($return as $js) {
        if ($js['ext'] == 1) {
            $res .= "<script src=\"" . $js['content'] . "\"></script>" . PHP_EOL;
        } else {
            $res .= "<script>" . PHP_EOL;
            $res .= $js['content'] . PHP_EOL;
            $res .= "</script>" . PHP_EOL;
        }
    }
    return $res;
}
    die('Stop!!!');
}
$page_title = $lang_module['browser'];
$key_words = $module_info['keywords'];
$mod_title = $lang_module['browser'];
$sql = "SELECT COUNT(*), MAX(`c_count`) FROM `" . NV_COUNTER_TABLE . "` WHERE `c_type`='browser' AND `c_count`!=0";
$result = $db->sql_query($sql);
list($all_page, $max) = $db->sql_fetchrow($result);
if ($all_page) {
    $page = $nv_Request->get_int('page', 'get', 0);
    $per_page = 50;
    $base_url = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=allbrowsers";
    $sql = "SELECT `c_val`,`c_count`, `last_update` FROM `" . NV_COUNTER_TABLE . "` WHERE `c_type`='browser' AND `c_count`!=0 ORDER BY `c_count` DESC LIMIT " . $page . "," . $per_page;
    $result = $db->sql_query($sql);
    $browsers_list = array();
    while (list($browser, $count, $last_visit) = $db->sql_fetchrow($result)) {
        $last_visit = !empty($last_visit) ? nv_date("l, d F Y H:i", $last_visit) : "";
        $browsers_list[$browser] = array($count, $last_visit);
    }
    if (!empty($browsers_list)) {
        $cts = array();
        $cts['thead'] = array($lang_module['browser'], $lang_module['hits'], $lang_module['last_visit']);
        $cts['rows'] = $browsers_list;
        $cts['max'] = $max;
        $cts['generate_page'] = nv_generate_page($base_url, $all_page, $per_page, $page);
    }
}
$contents = call_user_func("allbrowsers");
include NV_ROOTDIR . "/includes/header.php";
echo nv_site_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
 /**
  * nv_relates_product()
  *
  * @param mixed $block_config
  * @return
  */
 function nv_relates_product($block_config)
 {
     global $site_mods, $global_config, $lang_module, $module_config, $module_config, $module_name, $module_info, $global_array_shops_cat, $db_config, $my_head, $db, $pro_config, $money_config;
     $module = $block_config['module'];
     $mod_data = $site_mods[$module]['module_data'];
     $mod_file = $site_mods[$module]['module_file'];
     if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $mod_file . '/block.others_product.tpl')) {
         $block_theme = $global_config['site_theme'];
     } else {
         $block_theme = 'default';
     }
     if ($module != $module_name) {
         $sql = 'SELECT catid, parentid, lev, ' . NV_LANG_DATA . '_title AS title, ' . NV_LANG_DATA . '_alias AS alias, viewcat, numsubcat, subcatid, numlinks, ' . NV_LANG_DATA . '_description AS description, inhome, ' . NV_LANG_DATA . '_keywords AS keywords, groups_view, typeprice FROM ' . $db_config['prefix'] . '_' . $mod_data . '_catalogs ORDER BY sort ASC';
         $list = $nv_Cache->db($sql, 'catid', $module);
         foreach ($list as $row) {
             $global_array_shops_cat[$row['catid']] = array('catid' => $row['catid'], 'parentid' => $row['parentid'], 'title' => $row['title'], 'alias' => $row['alias'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $row['alias'], 'viewcat' => $row['viewcat'], 'numsubcat' => $row['numsubcat'], 'subcatid' => $row['subcatid'], 'numlinks' => $row['numlinks'], 'description' => $row['description'], 'inhome' => $row['inhome'], 'keywords' => $row['keywords'], 'groups_view' => $row['groups_view'], 'lev' => $row['lev'], 'typeprice' => $row['typeprice']);
         }
         unset($list, $row);
         // Css
         if (file_exists(NV_ROOTDIR . '/themes/' . $block_theme . '/css/' . $mod_file . '.css')) {
             $my_head .= '<link rel="StyleSheet" href="' . NV_BASE_SITEURL . 'themes/' . $block_theme . '/css/' . $mod_file . '.css" type="text/css" />';
         }
         // Language
         if (file_exists(NV_ROOTDIR . '/modules/' . $mod_file . '/language/' . NV_LANG_DATA . '.php')) {
             require_once NV_ROOTDIR . '/modules/' . $mod_file . '/language/' . NV_LANG_DATA . '.php';
         }
         $pro_config = $module_config[$module];
         // Lay ty gia ngoai te
         $sql = 'SELECT code, currency, exchange, round, number_format FROM ' . $db_config['prefix'] . '_' . $mod_data . '_money_' . NV_LANG_DATA;
         $cache_file = NV_LANG_DATA . '_' . md5($sql) . '_' . NV_CACHE_PREFIX . '.cache';
         if (($cache = $nv_Cache->getItem($module, $cache_file)) != false) {
             $money_config = unserialize($cache);
         } else {
             $money_config = array();
             $result = $db->query($sql);
             while ($row = $result->fetch()) {
                 $money_config[$row['code']] = array('code' => $row['code'], 'currency' => $row['currency'], 'exchange' => $row['exchange'], 'round' => $row['round'], 'number_format' => $row['number_format'], 'decimals' => $row['round'] > 1 ? $row['round'] : strlen($row['round']) - 2, 'is_config' => $row['code'] == $pro_config['money_unit'] ? 1 : 0);
             }
             $result->closeCursor();
             $cache = serialize($money_config);
             $nv_Cache->setItem($module, $cache_file, $cache);
         }
     }
     $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=';
     $xtpl = new XTemplate('block.others_product.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
     $xtpl->assign('LANG', $lang_module);
     $xtpl->assign('WIDTH', $pro_config['homewidth']);
     $db->sqlreset()->select('t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title AS title, t1.' . NV_LANG_DATA . '_alias AS alias, t1.addtime, t1.homeimgfile, t1.homeimgthumb, t1.product_price, t1.money_unit, t1.discount_id, t1.showprice')->from($db_config['prefix'] . '_' . $mod_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $mod_data . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $block_config['blockid'] . ' AND t1.status =1')->order('t1.addtime DESC, t2.weight ASC')->limit($block_config['numrow']);
     $list = $nv_Cache->db($db->sql(), 'id', $module);
     $i = 1;
     $cut_num = $block_config['cut_num'];
     foreach ($list as $row) {
         if ($row['homeimgthumb'] == 1) {
             $src_img = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile'];
         } elseif ($row['homeimgthumb'] == 2) {
             $src_img = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile'];
         } elseif ($row['homeimgthumb'] == 3) {
             $src_img = $row['homeimgfile'];
         } else {
             $src_img = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/shops/no-image.jpg';
         }
         $xtpl->assign('link', $link . $global_array_shops_cat[$row['listcatid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl']);
         $xtpl->assign('title', nv_clean60($row['title'], $cut_num));
         $xtpl->assign('src_img', $src_img);
         $xtpl->assign('time', nv_date('d-m-Y h:i:s A', $row['addtime']));
         if ($pro_config['active_price'] == '1') {
             if ($row['showprice'] == '1') {
                 $price = nv_get_price_tmp($module, $mod_data, $mod_file, $row['id']);
                 //var_dump($price); die;
                 $xtpl->assign('PRICE', $price);
                 if ($row['discount_id'] and $price['discount_percent'] > 0) {
                     $xtpl->parse('main.loop.price.discounts');
                 } else {
                     $xtpl->parse('main.loop.price.no_discounts');
                 }
                 $xtpl->parse('main.loop.price');
             } else {
                 $xtpl->parse('main.loop.contact');
             }
         }
         $xtpl->parse('main.loop');
         ++$i;
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
Example #19
0
function nv_comment_module_data_reply($module, $comment_array, $is_delete)
{
    global $global_config, $module_file, $module_config, $lang_module_comment;
    $template = file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/comment/comment.tpl') ? $global_config['module_theme'] : 'default';
    $xtpl = new XTemplate('comment.tpl', NV_ROOTDIR . '/themes/' . $template . '/modules/comment');
    $xtpl->assign('TEMPLATE', $template);
    $xtpl->assign('LANG', $lang_module_comment);
    foreach ($comment_array as $comment_array_i) {
        if (!empty($comment_array_i['subcomment'])) {
            $comment_array_reply = nv_comment_module_data_reply($module, $comment_array_i['subcomment'], $is_delete);
            $xtpl->assign('CHILDREN', $comment_array_reply);
            $xtpl->parse('children.detail.children');
        }
        $comment_array_i['post_time'] = nv_date('d/m/Y H:i', $comment_array_i['post_time']);
        if (!empty($comment_array_i['photo']) && file_exists(NV_ROOTDIR . '/' . $comment_array_i['photo'])) {
            $comment_array_i['photo'] = NV_BASE_SITEURL . $comment_array_i['photo'];
        } else {
            $comment_array_i['photo'] = NV_BASE_SITEURL . 'themes/' . $global_config['module_theme'] . '/images/users/no_avatar.png';
        }
        if (!empty($comment_array_i['userid'])) {
            $comment_array_i['post_name'] = nv_show_name_user($comment_array_i['first_name'], $comment_array_i['last_name']);
        }
        $xtpl->assign('COMMENT', $comment_array_i);
        if ($module_config[$module]['emailcomm'] and !empty($comment_array_i['post_email'])) {
            $xtpl->parse('children.detail.emailcomm');
        }
        if ($is_delete) {
            $xtpl->parse('children.detail.delete');
        }
        $xtpl->parse('children.detail');
    }
    $xtpl->parse('children');
    return $xtpl->text('children');
}
Example #20
0
    $transaction_i = $nl->checkOrder($payment_config['public_api_url'], $order_code, 0);
    if ($transaction_i !== false) {
        print_r($transaction_i);
        die;
    }
}
$a = 1;
$array_transaction = array();
$result = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_transaction WHERE order_id=' . $order_id . ' ORDER BY transaction_id ASC');
if ($result->rowCount()) {
    $array_payment = array();
    while ($row = $result->fetch()) {
        $row['a'] = $a++;
        $row['transaction_time'] = nv_date('H:i:s d/m/y', $row['transaction_time']);
        $row['order_id'] = !empty($row['order_id']) ? $row['order_id'] : '';
        $row['payment_time'] = !empty($row['payment_time']) ? nv_date('H:i:s d/m/y', $row['payment_time']) : '';
        $row['payment_id'] = !empty($row['payment_id']) ? $row['payment_id'] : '';
        if (!empty($row['payment_id'])) {
            $array_payment[] = $row['payment_id'];
        }
        $row['payment_amount'] = nv_number_format($row['payment_amount'], nv_get_decimals($pro_config['money_unit']));
        if ($row['transaction_status'] == 4) {
            $row['transaction'] = $lang_module['history_payment_yes'];
        } elseif ($row['transaction_status'] == 3) {
            $row['transaction'] = $lang_module['history_payment_cancel'];
        } elseif ($row['transaction_status'] == 2) {
            $row['transaction'] = $lang_module['history_payment_check'];
        } elseif ($row['transaction_status'] == 1) {
            $row['transaction'] = $lang_module['history_payment_send'];
        } elseif ($row['transaction_status'] == 0) {
            $row['transaction'] = $lang_module['history_payment_no'];
Example #21
0
 $content = array_merge($content, $body_contents);
 unset($sql, $result, $body_contents);
 if ($content['allowed_print'] == 1 and (defined('NV_IS_MODADMIN') or $content['status'] == 1 and $content['publtime'] < NV_CURRENTTIME and ($content['exptime'] == 0 or $content['exptime'] > NV_CURRENTTIME))) {
     $base_url_rewrite = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=print/' . $global_array_cat[$catid]['alias'] . '/' . $content['alias'] . '-' . $id . $global_config['rewrite_exturl'], true);
     if ($_SERVER['REQUEST_URI'] != $base_url_rewrite and NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
         Header('Location: ' . $base_url_rewrite);
         die;
     }
     $sql = 'SELECT title FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources WHERE sourceid = ' . $content['sourceid'];
     $result = $db_slave->query($sql);
     $sourcetext = $result->fetchColumn();
     unset($sql, $result);
     $base_url_rewrite = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'] . '/' . $content['alias'] . '-' . $id . $global_config['rewrite_exturl'], true);
     $canonicalUrl = NV_MAIN_DOMAIN . $base_url_rewrite;
     $meta_tags = nv_html_meta_tags();
     $result = array('url' => $global_config['site_url'], 'meta_tags' => $meta_tags, 'sitename' => $global_config['site_name'], 'title' => $content['title'], 'alias' => $content['alias'], 'image' => '', 'position' => $content['imgposition'], 'time' => nv_date('l - d/m/Y H:i', $content['publtime']), 'status' => $content['status'], 'hometext' => $content['hometext'], 'bodytext' => $content['bodytext'], 'copyright' => $content['copyright'], 'copyvalue' => $module_config[$module_name]['copyright'], 'link' => "<a href=\"" . NV_MY_DOMAIN . $base_url_rewrite . "\" title=\"" . $content['title'] . "\">" . NV_MY_DOMAIN . $base_url_rewrite . "</a>\n", 'contact' => $global_config['site_email'], 'author' => $content['author'], 'source' => $sourcetext);
     if (!empty($content['homeimgfile']) and $content['imgposition'] > 0) {
         $src = $alt = $note = '';
         $width = $height = 0;
         if ($content['homeimgthumb'] == 1 and $content['imgposition'] == 1) {
             $src = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
             $width = $module_config[$module_name]['homewidth'];
         } elseif ($content['homeimgthumb'] == 3) {
             $src = $content['homeimgfile'];
             $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
         } elseif (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $content['homeimgfile'])) {
             $src = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
             $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
         }
         $alt = empty($content['homeimgalt']) ? $content['title'] : $content['homeimgalt'];
         $result['image'] = array('src' => $src, 'width' => $width, 'alt' => $alt, 'note' => $content['homeimgalt'], 'position' => $content['imgposition']);
Example #22
0
    include NV_ROOTDIR . '/includes/footer.php';
    die;
}
//Danh sach nhom
if ($nv_Request->isset_request('list', 'get')) {
    $weight_op = 1;
    foreach ($groupsList as $group_id => $values) {
        $xtpl->assign('GROUP_ID', $group_id);
        if ($group_id < 4 or $group_id > 9) {
            $link_userlist = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;userlist=' . $group_id;
        } elseif ($group_id == 4) {
            $link_userlist = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
        } else {
            $link_userlist = '#';
        }
        $loop = array('title' => $values['title'], 'add_time' => nv_date('d/m/Y H:i', $values['add_time']), 'exp_time' => !empty($values['exp_time']) ? nv_date('d/m/Y H:i', $values['exp_time']) : $lang_global['unlimited'], 'publics' => $values['publics'] ? ' checked="checked"' : '', 'number' => number_format($values['numbers']), 'act' => $values['act'] ? ' checked="checked"' : '', 'link_userlist' => $link_userlist);
        if (defined('NV_IS_SPADMIN') and $group_id > 9 and $values['idsite'] == $global_config['idsite']) {
            $_bg = empty($global_config['idsite']) ? $weight_op : 1;
            for ($i = $_bg; $i <= $groupcount; $i++) {
                $opt = array('value' => $i, 'selected' => $i == $values['weight'] ? ' selected="selected"' : '');
                $xtpl->assign('NEWWEIGHT', $opt);
                $xtpl->parse('list.loop.option');
            }
            $xtpl->parse('list.loop.action');
        } else {
            ++$weight_op;
            $opt = array('value' => $values['weight'], 'selected' => ' selected="selected"');
            $xtpl->assign('NEWWEIGHT', $opt);
            $xtpl->parse('list.loop.option');
            $loop['act'] .= ' disabled="disabled"';
            if ($group_id < 9) {
Example #23
0
        $_cont = "<textarea style=\"width:100%;height:300px\" name=\"content\" id=\"content\">" . $post['content'] . "</textarea>";
    }
    $xtpl->assign('CONTENT', $_cont);
    $xtpl->parse('add');
    $contents = $xtpl->text('add');
    $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/popcalendar/popcalendar.js\"></script>\n";
    include NV_ROOTDIR . "/includes/header.php";
    echo nv_admin_theme($contents);
    include NV_ROOTDIR . "/includes/footer.php";
    die;
}
//Danh sach nhom
if ($nv_Request->isset_request('list', 'get')) {
    $a = 0;
    foreach ($groupsList as $id => $values) {
        $loop = array('id' => $id, 'title' => $values['title'], 'add_time' => nv_date("d.m.Y H:i", $values['add_time']), 'exp_time' => !empty($values['exp_time']) ? nv_date("d.m.Y H:i", $values['exp_time']) : $lang_global['unlimited'], 'public' => $values['public'] ? " checked=\"checked\"" : "", 'users' => !empty($values['users']) ? sizeof(explode(",", $values['users'])) : 0, 'act' => $values['act'] ? " checked=\"checked\"" : "");
        $xtpl->assign('LOOP', $loop);
        for ($i = 1; $i <= $groupcount; $i++) {
            $opt = array('value' => $i, 'selected' => $i == $values['weight'] ? " selected=\"selected\"" : "");
            $xtpl->assign('NEWWEIGHT', $opt);
            $xtpl->parse('list.loop.option');
        }
        $xtpl->assign('CLASS', $a % 2 ? " class=\"second\"" : "");
        $xtpl->parse('list.loop');
        $a++;
    }
    $xtpl->parse('list');
    $xtpl->out('list');
    exit;
}
//Trang chu
 function nv_block_album_new($block_config)
 {
     global $module_photo_category, $module_info, $site_mods, $module_config, $global_config, $db, $blockID;
     $module = $block_config['module'];
     $thumb_width = $module_config[$module]['cr_thumb_width'];
     $thumb_height = $module_config[$module]['cr_thumb_height'];
     $thumb_quality = $module_config[$module]['cr_thumb_quality'];
     $mod_data = $site_mods[$module]['module_data'];
     $mod_file = $site_mods[$module]['module_file'];
     $db->sqlreset()->select('a.album_id, a.category_id, a.name, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, a.capturedate, r.file, r.thumb')->from(NV_PREFIXLANG . '_' . $mod_data . '_album a LEFT JOIN  ' . NV_PREFIXLANG . '_' . $mod_data . '_rows r ON ( a.album_id = r.album_id )')->where('a.status= 1 AND r.defaults = 1')->order('a.date_added DESC')->limit($block_config['numrow']);
     $list = nv_db_cache($db->sql(), 'album_id', $module);
     if (!empty($list)) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $mod_file . '/block_album_new.tpl')) {
             $block_theme = $global_config['module_theme'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block_album_new.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
         $xtpl->assign('BLOCK_ID', $blockID);
         foreach ($list as $album) {
             $album['name'] = nv_clean60($album['name'], $block_config['title_length']);
             $album['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $module_photo_category[$album['category_id']]['alias'] . '/' . $album['alias'] . '-' . $album['album_id'];
             $album['description'] = strip_tags(nv_clean60($album['description'], $block_config['des_length']));
             $album['date_added'] = nv_date('d/m/Y', $album['date_added']);
             $album['capturedate'] = nv_date('d/m/Y', $album['capturedate']);
             $album['thumb'] = photos_thumbs($album['album_id'], $album['file'], $module, $thumb_width, $thumb_height, $thumb_quality);
             $album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/images/' . $album['file'];
             $xtpl->assign('ALBUM', $album);
             $xtpl->parse('main.loop_album');
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Example #25
0
/**
 * nv_search_theme()
 * 
 * @param mixed $array
 * @param mixed $page
 * @param mixed $total_pages
 * @param mixed $all_page
 * @param mixed $generate_page
 * @param mixed $BL
 * @return
 */
function nv_search_theme($array, $page, $total_pages, $all_page, $generate_page, $BL)
{
    global $lang_global, $lang_module, $module_file, $module_info;
    $xtpl = new XTemplate("search.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('GLANG', $lang_global);
    $xtpl->assign('LANG', $lang_module);
    if (empty($array['contents']) and !empty($array['q'])) {
        $xtpl->assign('NORESULT_MESSAGE', nv_message_theme(sprintf($BL->lang('searchNoResult'), $array['q']), 1));
        $xtpl->parse('main.noResult');
    }
    if (!empty($array['contents'])) {
        $xtpl->assign('RESULT_INFO', sprintf($BL->lang('searchResultInfo'), $all_page, $array['q']));
        $xtpl->assign('PAGE_TOTAL', $total_pages);
        $xtpl->assign('PAGE_CURRENT', $page);
        foreach ($array['contents'] as $row) {
            $row['title'] = $BL->BoldKeywordInStr($row['title'], $array['q']);
            $row['hometext'] = $BL->BoldKeywordInStr($row['hometext'], $array['q']);
            $row['pubtime'] = str_replace(array(' AM ', ' PM '), array(' SA ', ' CH '), nv_date('g:i A d/m/Y', $row['pubtime']));
            $row['numcomments'] = number_format($row['numcomments'], 0, ',', '.');
            $row['linkComment'] = nv_url_rewrite($row['link'], true) . '#comment';
            $row['icon'] = empty($BL->setting['iconClass' . $row['posttype']]) ? 'icon-pencil' : $BL->setting['iconClass' . $row['posttype']];
            $xtpl->assign('ROW', $row);
            $xtpl->parse('main.result.loop');
        }
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.result.generate_page');
        }
        $xtpl->parse('main.result');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Example #26
0
if ($array_search['active'] >= 0) {
    $base_url .= '&active=' . $array_search['active'];
    $where[] = 'status=' . $array_search['active'];
}
$db->sqlreset()->select('COUNT(*)')->from(NV_MOD_TABLE);
if (!empty($where)) {
    $db->where(implode(' AND ', $where));
}
$num_items = $db->query($db->sql())->fetchColumn();
$page = $nv_Request->get_int('page', 'get', 1);
$per_page = $array_search['per_page'];
$db->select('*')->order('uploadtime DESC')->limit($per_page)->offset(($page - 1) * $per_page);
$result2 = $db->query($db->sql());
$array = array();
while ($row = $result2->fetch()) {
    $array[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'cattitle' => $list_cats[$row['catid']]['title'], 'catlink' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;catid=' . $row['catid'], 'uploadtime' => nv_date('d/m/Y H:i', $row['uploadtime']), 'status' => $row['status'] ? ' checked="checked"' : '', 'view_hits' => $row['view_hits'], 'download_hits' => $row['download_hits'], 'comment_hits' => $row['comment_hits']);
}
$generate_page = nv_generate_page($base_url, $num_items, $per_page, $page);
$array_list_action = array('del0' => $lang_module['file_delmode0'], 'del1' => $lang_module['file_delmode1'], 'active' => $lang_module['action_active'], 'deactive' => $lang_module['action_deactive']);
$xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
$xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
$xtpl->assign('SEARCH', $array_search);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
Example #27
0
        while ($row = $result->fetch()) {
            $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_new.gif', 12, 9);
            $status = 'New';
            $style = " style=\"font-weight:bold;cursor:pointer;white-space:nowrap;\"";
            if ($row['is_read'] == 1) {
                $style = " style=\"cursor:pointer;white-space:nowrap;\"";
                if ($row['is_reply']) {
                    $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_reply.gif', 13, 14);
                    $status = $lang_module['tt2_row_title'];
                } else {
                    $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_old.gif', 12, 11);
                    $status = $lang_module['tt1_row_title'];
                }
            }
            $onclick = "onclick=\"location.href='" . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=view&amp;id=" . $row['id'] . "'\"";
            $xtpl->assign('ROW', array('id' => $row['id'], 'sender_name' => $row['sender_name'], 'path' => $contact_allowed['view'][$row['cid']], 'cat' => $row['cat'], 'title' => nv_clean60($row['title'], 60), 'time' => $row['send_time'] >= $currday ? nv_date('H:i d/m/Y', $row['send_time']) : nv_date('d/m/Y', $row['send_time']), 'style' => $style, 'onclick' => $onclick, 'status' => $status, 'image' => $image));
            $xtpl->parse('main.data.row');
        }
        $generate_page = nv_generate_page($base_url, $num_items, $per_page, $page);
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.data.generate_page');
        }
    }
}
if (empty($num_items)) {
    $xtpl->parse('main.empty');
} else {
    $xtpl->parse('main.data');
}
$xtpl->parse('main');
Example #28
0
    if (!empty($key)) {
        $keyword = '%' . addcslashes($key, '_%') . '%';
        $sth->bindParam(':keyword1', $keyword, PDO::PARAM_STR);
        $sth->bindParam(':keyword2', $keyword, PDO::PARAM_STR);
        $sth->bindParam(':keyword3', $keyword, PDO::PARAM_STR);
    }
    $sth->execute();
    while ($row = $sth->fetch()) {
        $cattitle = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '">' . $list_cats[$row['catid']]['title'] . '</a>';
        $uploadtime = (int) $row['uploadtime'];
        if ($uploadtime >= $today) {
            $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']);
        } elseif ($uploadtime >= $yesterday) {
            $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']);
        } else {
            $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']);
        }
        $array[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'cattitle' => $cattitle, 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => $row['author_name'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : '', 'imagesrc' => !empty($row['fileimage']) ? NV_BASE_SITEURL . NV_FILES_DIR . $row['fileimage'] : '', 'view_hits' => $row['view_hits'], 'download_hits' => $row['download_hits'], 'more_link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;edit=1&amp;id=' . $row['id'] : '', 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name : '');
    }
    $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
    $contents = theme_viewcat_list($array, $generate_page);
    if ($page > 1) {
        $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
    }
} else {
    $contents = $lang_module['search_noresult'];
}
$key_words = $description = 'no';
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Example #29
0
}
$sql = $db->sql();
$sth = $db->prepare($sql);
if ($check_like) {
    $keyword = '%' . addcslashes($data_search['q'], '_%') . '%';
    $sth->bindParam(':keyword1', $keyword, PDO::PARAM_STR);
    $sth->bindParam(':keyword2', $keyword, PDO::PARAM_STR);
}
$sth->execute();
while ($data_i = $sth->fetch()) {
    if ($data_i['userid'] != 0) {
        if (!in_array($data_i['userid'], $array_userid)) {
            $array_userid[] = $data_i['userid'];
        }
    }
    $data_i['time'] = nv_date('d/m/Y h:i:s A', $data_i['log_time']);
    $data[] = $data_i;
    unset($data_i);
}
$data_users = array();
$data_users[0] = 'system';
if (!empty($array_userid)) {
    $result_users = $db->query('SELECT userid, username FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid IN (' . implode(',', $array_userid) . ')');
    while ($data_i = $result_users->fetch()) {
        $data_users[$data_i['userid']] = $data_i['username'];
    }
    unset($data_i, $result_users);
}
$list_lang = nv_siteinfo_getlang();
$array_lang = array();
$array_lang[] = array('key' => '', 'title' => $lang_module['filter_lang'], 'selected' => $data_search['lang'] == '' ? ' selected="selected"' : '');
Example #30
0
}
$result = $db->sql_query($sql);
$result_all = $db->sql_query("SELECT FOUND_ROWS()");
list($numf) = $db->sql_fetchrow($result_all);
$all_page = $numf ? $numf : 1;
while (list($id, $listcatid, $admin_id, $title, $alias, $status, $publtime, $exptime, $is_notice) = $db->sql_fetchrow($result)) {
    if ($status == 0) {
        $status = $lang_module['status_0'];
    } elseif ($publtime <= NV_CURRENTTIME and ($exptime == 0 or $exptime > NV_CURRENTTIME)) {
        $status = $lang_module['status_1'];
    } elseif ($publtime > NV_CURRENTTIME) {
        $status = $lang_module['status_2'];
    } else {
        $status = $lang_module['status_3'];
    }
    $publtime = nv_date("H:i d/m/y", $publtime);
    $title = nv_clean60($title);
    $class = $a % 2 == 0 ? "" : " class=\"second\"";
    $catid_i = 0;
    if ($catid > 0) {
        $catid_i = $catid;
    } else {
        $listcatid_arr = explode(",", $listcatid);
        $catid_i = $listcatid_arr[0];
    }
    // is notice
    if ($is_notice) {
        $is_notice = $lang_module['yes'];
    } else {
        $is_notice = $lang_module['no'];
    }