Example #1
0
function main($query, $type, $joke_id, $cat_id, $limit)
{
    if ($query == 'cat') {
        get_cat($type);
    } elseif ($query == 'joke') {
        get_joke($type, $joke_id, $cat_id, $limit);
    } else {
        write_error($GLOBALS['ERR_PARAMS_QUERY']);
    }
}
Example #2
0
function get_cat($page_id, $level)
{
    global $ft, $rewrite;
    $query = sprintf("\r\n        SELECT \r\n            id, \r\n            parent_id, \r\n            title \r\n        FROM \r\n            %1\$s \r\n        WHERE \r\n            parent_id = '%2\$d' \r\n        AND \r\n            published = 'Y' \r\n        ORDER BY \r\n            id \r\n        ASC", TABLE_PAGES, $page_id);
    $db = new DB_SQL();
    $db->query($query);
    while ($db->next_record()) {
        $page_id = $db->f("id");
        $parent_id = $db->f("parent_id");
        $page_name = $db->f("title");
        $page_link = (bool) $rewrite ? '1,' . $page_id . ',5,item.html' : 'index.php?p=5&id=' . $page_id . '';
        $ft->assign(array('PAGE_NAME' => $page_name, 'PAGE_ID' => $page_id, 'CLASS' => "child", 'PARENT' => str_repeat('  ', $level), 'PAGE_LINK' => $page_link));
        $ft->parse('PAGES_ROW', ".pages_row");
        get_cat($page_id, $level + 2);
    }
}
Example #3
0
// {
// 	message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
// }
//
// $category_rows = array();
// while ($row = $db->sql_fetchrow($result))
// {
//	$category_rows[] = $row;
// }
// $db->sql_freeresult($result);
//
// get the nav sentence
$nav_cat_desc = make_cat_nav_tree($viewcat, false);
//
// categories array
$category_rows = get_cat($viewcat);
// End PNphpBB2 Categories Hierarchie Mod
if ($total_categories = count($category_rows)) {
    //
    // Define appropriate SQL
    //
    switch (SQL_LAYER) {
        case 'postgresql':
            $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id \n\t\t\t\tFROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u\n\t\t\t\tWHERE p.post_id = f.forum_last_post_id \n\t\t\t\t\tAND u.user_id = p.poster_id  \n\t\t\t\t\tUNION (\n\t\t\t\t\t\tSELECT f.*, NULL, NULL, NULL, NULL\n\t\t\t\t\t\tFROM " . FORUMS_TABLE . " f\n\t\t\t\t\t\tWHERE NOT EXISTS (\n\t\t\t\t\t\t\tSELECT p.post_time\n\t\t\t\t\t\t\tFROM " . POSTS_TABLE . " p\n\t\t\t\t\t\t\tWHERE p.post_id = f.forum_last_post_id  \n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t\tORDER BY cat_id, forum_order";
            break;
        case 'oracle':
            $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id \n\t\t\t\tFROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u\n\t\t\t\tWHERE p.post_id = f.forum_last_post_id(+)\n\t\t\t\t\tAND u.user_id = p.poster_id(+)\n\t\t\t\tORDER BY f.cat_id, f.forum_order";
            break;
        default:
            $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id\n\t\t\t\tFROM (( " . FORUMS_TABLE . " f\n\t\t\t\tLEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )\n\t\t\t\tLEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )\n\t\t\t\tORDER BY f.cat_id, f.forum_order";
            break;
Example #4
0
 function add($post)
 {
     global $MOD, $L;
     $post = $this->set($post);
     $sqlk = $sqlv = '';
     foreach ($post as $k => $v) {
         if (in_array($k, $this->fields)) {
             $sqlk .= ',' . $k;
             $sqlv .= ",'{$v}'";
         }
     }
     $sqlk = substr($sqlk, 1);
     $sqlv = substr($sqlv, 1);
     $this->db->query("INSERT INTO {$this->table} ({$sqlk}) VALUES ({$sqlv})");
     $this->itemid = $this->db->insert_id();
     $t = get_cat($this->itemid);
     if ($t) {
         $t = $this->db->get_one("SELECT MAX(catid) AS id FROM {$this->db->pre}category");
         $itemid = intval($t['id'] + 1);
         $this->db->query("UPDATE {$this->table} SET itemid={$itemid} WHERE itemid={$this->itemid}");
         $maxid = $itemid + 100;
         $this->db->query("INSERT {$this->db->pre}category (catid) VALUES ({$maxid})");
         $this->db->query("DELETE FROM {$this->db->pre}category WHERE catid={$maxid}");
         $this->itemid = $itemid;
     }
     $this->update($this->itemid);
     clear_upload($post['thumb']);
     return $this->itemid;
 }
Example #5
0
 function update($itemid)
 {
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . ($item['tag'] ? str_replace(' ', ',', trim($item['tag'])) . ',' : '') . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     $mobile = $this->m3u8($item['video']) ? 1 : 0;
     if ($mobile != $item['mobile']) {
         $update .= ",mobile='{$mobile}'";
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
Example #6
0
 function update($itemid)
 {
     global $TYPE;
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . $TYPE[$item['typeid']] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     } else {
         $keyword = str_replace("//", '', addslashes($keyword));
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     $member = $item['username'] ? userinfo($item['username']) : array();
     if ($member) {
         $update .= update_user($member, $item);
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
     $sorttime = $this->get_sorttime($item['edittime'], $item['vip']);
     $this->db->query("REPLACE INTO {$this->table_search} (itemid,catid,areaid,status,content,sorttime) VALUES ({$itemid},'{$item['catid']}','{$item['areaid']}','{$item['status']}','{$keyword}','{$sorttime}')");
 }
Example #7
0
 function update($itemid)
 {
     global $TYPE;
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . ($item['tag'] ? $item['tag'] . ',' : '') . $TYPE[$item['typeid']] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     $member = $item['username'] ? userinfo($item['username']) : array();
     if ($member) {
         $update .= update_user($member, $item);
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
Example #8
0
 function update($itemid)
 {
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . $item['company'] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     $member = $item['username'] ? userinfo($item['username']) : array();
     if ($member) {
         foreach (array('groupid', 'vip', 'validated', 'company', 'areaid', 'truename', 'telephone', 'mobile', 'address', 'qq', 'msn', 'ali', 'skype') as $v) {
             if ($item[$v] != $member[$v]) {
                 $update .= ",{$v}='" . addslashes($member[$v]) . "'";
             }
         }
         if ($item['email'] != $member['mail']) {
             $update .= ",email='" . addslashes($member['mail']) . "'";
         }
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
Example #9
0
        if (!$r || $r['username'] != $_username) {
            message();
        }
        $do->delete($itemid);
        dmsg($L['op_del_success'], $forward);
        break;
    default:
        $status = isset($status) ? intval($status) : 3;
        in_array($status, array(2, 3)) or $status = 3;
        $condition = "username='******' AND status={$status}";
        $lists = $do->get_list($condition);
        if ($lists) {
            $tmp = $MOD['linkurl'];
            foreach ($lists as $k => $v) {
                if ($v['catid']) {
                    $lists[$k]['cate'] = cat_pos(get_cat($v['catid']), '-', 1);
                }
                if ($v['email'] != $_email) {
                    $db->query("UPDATE {$DT_PRE}alert SET email='{$_email}' WHERE itemid={$v['itemid']}");
                }
            }
            $MOD['linkurl'] = $tmp;
        }
        $head_title = $L['alert_title'];
        break;
}
$nums = array();
$limit_used = 0;
for ($i = 2; $i < 4; $i++) {
    $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}alert WHERE username='******' AND status={$i}");
    $nums[$i] = $r['num'];
Example #10
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
$gid = $catid;
$GRP = get_group($gid);
if (!$GRP || $GRP['status'] != 3) {
    include load('404.inc');
}
if ($GRP['list_type'] && !is_fans($GRP)) {
    $action = 'list';
    $head_title = lang('message->without_permission');
    exit(include template('nofans', $module));
}
$CAT = get_cat($GRP['catid']);
$GRP['managers'] = $GRP['manager'] ? explode('|', $GRP['manager']) : array();
$admin = is_admin($GRP);
$typeid = isset($typeid) ? intval($typeid) : 0;
isset($TYPE[$typeid]) or $typeid = 0;
$condition = 'status=3 AND gid=' . $catid;
if ($typeid) {
    switch ($typeid) {
        case 1:
            $MOD['order'] = 'addtime DESC';
            break;
        case 2:
            $MOD['order'] = 'replytime DESC';
            break;
        case 3:
            $condition .= " AND level>0";
            break;
        case 4:
Example #11
0
File: index.php Project: Net7x/vt
		 
		 <!-- Begin Right Column -->
		 <div id="rightcolumn">
<?php 
if (isset($_GET['cat'])) {
    if (isset($_GET['sub'])) {
        if (isset($_GET['item'])) {
            // need to show item with description
            $item_id = $_GET['item'];
            $res = mysql_safe("SELECT id, id_subcat, name, price FROM items WHERE id=?", array($item_id));
            if (mysql_num_rows($res) > 0) {
                // everything is Ok, item exists
                $row = mysql_fetch_array($res);
                echo "<p id='itemtitle'>" . $row['name'] . "</p>";
                echo "<table width = 100%><tr>";
                $cur_cat = get_cat($row['id_subcat']);
                $cur_sub = $row['id_subcat'];
                $cur_item = $row['id'];
                $cur_name = $row['name'];
                mysql_query("INSERT INTO hits (`subcat`,`item`,`host`,`ip`) VALUES('{$cur_sub}','{$cur_item}','{$host}','{$cur_ip}')");
                $res1 = mysql_safe("SELECT id FROM items WHERE (id_subcat=?) AND (name=(SELECT MAX(name) FROM items WHERE (name<?) AND (id_subcat=?)))", array($cur_sub, $cur_name, $cur_sub));
                if (mysql_num_rows($res1) > 0) {
                    $row1 = mysql_fetch_array($res1);
                    echo "<td align='left' width=30%><a href='index.php?cat=" . $cur_cat . "&sub=" . $cur_sub . "&item=" . $row1['id'] . "' class='pointer'>&lt;&lt;&lt; предыдущий товар</a></td>";
                } else {
                    echo "<td align='left' width=30%> &nbsp; </td>";
                }
                $res2 = mysql_safe("SELECT percent, round FROM subcat WHERE id = ?", array($cur_sub));
                $row2 = mysql_fetch_array($res2);
                $sell = 0;
                if ($row2['percent'] > 0) {
Example #12
0
function show_concat_waste($ref_sell, $price_call)
{
    mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    mysql_select_db('dbs3') or die(mysql_error());
    $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' GROUP BY type_item ORDER By type_item";
    //echo $ref_sell;
    $reuse = array();
    $cust = add_db($customer1);
    $waste_barcode = array();
    $waste_barcode_weight = array();
    //echo "bf fetch";
    while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
        //changed from 1
        $i++;
        //echo " in fetch ";
        //if($tab[$rek["id_test"]]<'1')
        //{
        //here we count unige barcode waste and add to array
        $index = $rek['type_item'];
        // echo " <BR /> ";
        $waste_barcode[$index] += $rek['quantity'];
        $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
        //echo '<tr>';
        //echo '<td>'.get_item_name($rek['type_item']).'</td>';
        // echo '<td>'.$rek["quantity"].'</td>';
        // echo '<td>'.$rek["category"].'</td>';
        //   echo '<td>'.$rek["pn"].'.</td>';
        //     	echo '<td>1</td>';
        //echo '<td>'.$rek["sum_weight"].'</td>';
        // echo '<td>'.$rek["Name_sub"].'</td>';
        //echo '</tr>';
        $cat = $rek['category'];
        $reuse[$cat] += $rek['weight'] * $rek['quantity'];
        //}
        //$tab[$rek["id_test"]]+=1;
    }
    $waste_barcode[3];
    $waste_barcode_weight[3];
    echo '<form action="sell_item_invoice_waste.php?invoice=1&ref_sell=' . $ref_sell . '" method="POST">';
    $weee_reused_waste_qtty = array();
    global $sum_rec;
    global $qtty_rec;
    global $ind_rec;
    for ($name_cat = 0; $name_cat < 62; $name_cat++) {
        if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
            echo "<tr>";
            echo "<td>";
            echo $sum_qtty_recalculate = $qtty + $waste_barcode[$name_cat];
            echo " UNIT </td>";
            echo "<td>";
            echo get_item_name($name_cat);
            echo "</td>";
            // echo '<td>';
            // echo get_weight_qtty($ref_sell, $name_cat)+$waste_barcode_weight[$name_cat];
            //    echo "</td>";
            //    echo "<td>".$name_cat."</td>";
            echo "<td>" . $sum_qtty_recalculate . " x </td>";
            // echo $sum_rec[$name_cat];
            echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $sum_qtty_recalculate . "'>";
            echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
            if ($sum_rec[$name_cat] > 0) {
                echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
            }
            echo "</tr>";
            $sum_qtty = get_weight_qtty($ref_sell, $name_cat);
            +$waste_barcode[$name_cat];
            $cat = get_cat($name_cat);
            $weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
        } else {
            $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
            $cust = add_db($customer1);
            while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
                $i++;
                //if($tab[$rek["id_test"]]<'1')
                //{
                //here we count unige barcode waste and add to array
                if ($rek['quantity'] > 0) {
                    $qtty_indiv = $rek["quantity"];
                    $index = $rek['type_item'];
                    $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
                    // echo " <BR /> ";
                    //$waste_barcode[$index]+=$rek['quantity'];
                    // $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
                    echo '<tr>';
                    echo '<td>' . $rek["quantity"] . ' Unit</td>';
                    echo '<td>' . get_item_name($rek['type_item']) . '</td>';
                    //   echo '<td>'.$waste_barcode_weight[$index]
                    //   .'</td>';
                    //  echo '<td>'.$rek["category"].'</td>';
                    // echo '<td>'.$rek["pn"].'.</td>';
                    //      	echo '<td>1</td>';
                    //echo '<td>'.$rek["sum_weight"].'</td>';
                    // echo '<td>'.$rek["Name_sub"].'</td>';
                    echo "<td>" . $qtty_indiv . " x </td>";
                    echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $qtty_indiv . "'>";
                    echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
                    if ($sum_rec[$name_cat] > 0) {
                        echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
                    }
                    echo '</tr>';
                    //  $cat=$rek['category'];
                    //  $reuse[$cat]+=$rek['weight'] * $rek['quantity'];
                    //}
                }
                //$tab[$rek["id_test"]]+=1;
            }
        }
    }
    global $sum_price;
    global $price_invoice_set;
    if ($sum_price > 0) {
        echo "<tr></tr>";
        echo "<tr><td colspan='4'></td><td> <b>Total value: " . $sum_price . "</b></td></tr>";
        echo "<input type='hidden' name='sum_set' value='" . $sum_price . "'";
        $price_invoice_set = $sum_price;
    }
    echo '<tr><input type="Submit" name="Recalculate" value="Recalculate"></tr>';
    echo '<BR />';
    echo '</form>';
}
Example #13
0
 function update($itemid)
 {
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $GRP = get_group($item['gid']);
     $keyword = $item['title'] . ',' . $GRP['title'] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     if ($item['username']) {
         $passport = addslashes(get_user($item['username'], 'username', 'passport'));
         if ($passport != $item['passport']) {
             $update .= ",passport='{$passport}'";
         }
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     if ($item['hits'] > 1 || $item['status'] == 3) {
         $reply = $this->db->count($this->table . '_reply', "tid={$itemid} AND status=3");
         if ($reply != $item['reply']) {
             $update .= ",reply='{$reply}'";
         }
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
<div id="headline_right"><h1>Seiten von: <?php 
echo $p_title;
?>
 im Webkatalog</h1></div>
</div>
<br clear="left" />
</div>

<br />

<div id="cat_seiten">
<?  
$pageurl="".$cat."/".$mod."";
$limit="5";
$orderby="typ";
get_cat($cat);
?>
<br />
</div>

<div id="cont_box">
<a href="seite-eintragen/1.html" rel="nofollow"><img src="templates/<?php 
echo get_aktiv_layout_data(layout_path);
?>
images/addsite.jpg" border="0" alt="Seite Anmelden Webkatalog" /></a>
<br /><br />
Nach <strong><?php 
echo $p_title;
?>
</strong> suchen auf: <a href="http://www.google.de/search?hl=de&q=<? echo $suchtag; ?>" target="_blank" rel="nofollow">[Google]</a> <a href="http://www.bing.com/search?q=<? echo $suchtag; ?>" target="_blank" rel="nofollow">[Bing]</a> <a href="http://search.lycos.de/cgi-bin/pursuit?query=<? echo $suchtag; ?>&cat=web&enc=utf-8" target="_blank" rel="nofollow">[Lycos]</a> <a href="http://de.search.yahoo.com/search?p=<? echo $suchtag; ?>" target="_blank" rel="nofollow">[Yahoo]</a>
</div>
Example #15
0
 function update($itemid)
 {
     global $TYPE;
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . $TYPE[$item['typeid']] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     } else {
         $keyword = str_replace("//", '', addslashes($keyword));
     }
     $item['itemid'] = $itemid;
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     $member = $item['username'] ? userinfo($item['username']) : array();
     if ($member) {
         foreach (array('groupid', 'vip', 'validated', 'company', 'areaid', 'truename', 'telephone', 'mobile', 'address', 'qq', 'msn', 'ali', 'skype') as $v) {
             if ($item[$v] != $member[$v]) {
                 $update .= ",{$v}='" . addslashes($member[$v]) . "'";
             }
         }
         if ($item['email'] != $member['mail']) {
             $update .= ",email='" . addslashes($member['mail']) . "'";
         }
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
     $sorttime = $this->get_sorttime($item['edittime'], $item['vip']);
     $this->db->query("REPLACE INTO {$this->table_search} (itemid,catid,areaid,status,content,sorttime) VALUES ({$itemid},'{$item['catid']}','{$item['areaid']}','{$item['status']}','{$keyword}','{$sorttime}')");
 }
Example #16
0
/**
 * CSV file import functions
 * @author René Haentjens , Ghent University
 */
function import_link($linkdata)
{
    // url, category_id, title, description, ...
    // Field names used in the uploaded file
    $known_fields = array('url', 'category', 'title', 'description', 'on_homepage', 'hidden');
    $hide_fields = array('kw', 'kwd', 'kwds', 'keyword', 'keywords');
    // All other fields are added to description, as "name:value".
    // Only one hide_field is assumed to be present, <> is removed from value.
    if (!($url = trim($linkdata['url'])) || !($title = trim($linkdata['title']))) {
        return 0;
        // 0 = fail
    }
    $cat = ($catname = trim($linkdata['category'])) ? get_cat($catname) : 0;
    $regs = array();
    // Will be passed to ereg()
    $d = '';
    foreach ($linkdata as $key => $value) {
        if (!in_array($key, $known_fields)) {
            if (in_array($key, $hide_fields) && ereg('^<?([^>]*)>?$', $value, $regs)) {
                // possibly in <...>
                if (($kwlist = trim($regs[1])) != '') {
                    $kw = '<i kw="' . htmlspecialchars($kwlist) . '">';
                } else {
                    $kw = '';
                }
                // i.e. assume only one of the $hide_fields will be present
                // and if found, hide the value as expando property of an <i> tag
            } elseif (trim($value)) {
                $d .= ', ' . $key . ':' . $value;
            }
        }
    }
    if (!empty($d)) {
        $d = substr($d, 2) . ' - ';
    }
    return put_link($url, $cat, $title, $kw . ereg_replace('\\[((/?(b|big|i|small|sub|sup|u))|br/)\\]', '<\\1>', htmlspecialchars($d . $linkdata['description'])) . ($kw ? '</i>' : ''), $linkdata['on_homepage'] ? '1' : '0', $linkdata['hidden'] ? '1' : '0');
    // i.e. allow some BBcode tags, e.g. [b]...[/b]
}
Example #17
0
function tag($parameter, $expires = 0)
{
    global $DT, $CFG, $MODULE, $DT_TIME, $db;
    if ($expires > 0) {
        $tag_expires = $expires;
    } else {
        if ($expires == -2) {
            $tag_expires = $CFG['db_expires'];
        } else {
            if ($expires == -1) {
                $tag_expires = 0;
            } else {
                $tag_expires = $CFG['tag_expires'];
            }
        }
    }
    $tag_cache = false;
    $db_cache = $expires == -2 || defined('TOHTML') ? 'CACHE' : '';
    if ($tag_expires && $db_cache != 'CACHE' && strpos($parameter, '&page=') === false) {
        $tag_cache = true;
        $TCF = DT_CACHE . '/tag/' . md5($parameter) . '.htm';
        if (is_file($TCF) && $DT_TIME - filemtime($TCF) < $tag_expires) {
            echo substr(file_get($TCF), 17);
            return;
        }
    }
    $parameter = str_replace(array('&amp;', '%'), array('', '##'), $parameter);
    $parameter = strip_sql($parameter);
    parse_str($parameter, $par);
    if (!is_array($par)) {
        return '';
    }
    $par = dstripslashes($par);
    extract($par, EXTR_SKIP);
    isset($prefix) or $prefix = $db->pre;
    isset($moduleid) or $moduleid = 1;
    if (!isset($MODULE[$moduleid])) {
        return '';
    }
    isset($fields) or $fields = '*';
    isset($catid) or $catid = 0;
    isset($child) or $child = 1;
    isset($areaid) or $areaid = 0;
    isset($areachild) or $areachild = 1;
    isset($dir) && check_name($dir) or $dir = 'tag';
    isset($template) && check_name($template) or $template = 'list';
    isset($condition) or $condition = '1';
    isset($group) or $group = '';
    isset($page) or $page = 1;
    isset($offset) or $offset = 0;
    isset($pagesize) or $pagesize = 10;
    isset($order) or $order = '';
    isset($showpage) or $showpage = 0;
    isset($showcat) or $showcat = 0;
    isset($datetype) or $datetype = 0;
    isset($target) or $target = '';
    isset($class) or $class = '';
    isset($length) or $length = 0;
    isset($introduce) or $introduce = 0;
    isset($debug) or $debug = 0;
    isset($lazy) or $lazy = 0;
    isset($cols) && $cols or $cols = 1;
    if ($catid) {
        if ($moduleid > 4) {
            if (is_numeric($catid)) {
                $CAT = $db->get_one("SELECT child,arrchildid,moduleid FROM {$db->pre}category WHERE catid={$catid}");
                $condition .= $child && $CAT['child'] && $CAT['moduleid'] == $moduleid ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}";
            } else {
                if ($child) {
                    $catids = '';
                    $result = $db->query("SELECT arrchildid FROM {$db->pre}category WHERE catid IN ({$catid})");
                    while ($r = $db->fetch_array($result)) {
                        $catids .= ',' . $r['arrchildid'];
                    }
                    if ($catids) {
                        $catid = substr($catids, 1);
                    }
                }
                $condition .= " AND catid IN ({$catid})";
            }
        } else {
            if ($moduleid == 4) {
                $condition .= " AND catids LIKE '%,{$catid},%'";
            }
        }
    }
    if ($areaid) {
        if (is_numeric($areaid)) {
            $ARE = $db->get_one("SELECT child,arrchildid FROM {$db->pre}area WHERE areaid={$areaid}");
            $condition .= $areachild && $ARE['child'] ? " AND areaid IN (" . $ARE['arrchildid'] . ")" : " AND areaid={$areaid}";
        } else {
            if ($areachild) {
                $areaids = '';
                $result = $db->query("SELECT arrchildid FROM {$db->pre}area WHERE areaid IN ({$areaid})");
                while ($r = $db->fetch_array($result)) {
                    $areaids .= ',' . $r['arrchildid'];
                }
                if ($areaids) {
                    $areaid = substr($areaids, 1);
                }
            }
            $condition .= " AND areaid IN ({$areaid})";
        }
    }
    $table = isset($table) ? $prefix . $table : get_table($moduleid);
    $offset or $offset = ($page - 1) * $pagesize;
    $percent = dround(100 / $cols) . '%';
    $num = 0;
    $order = $order ? ' ORDER BY ' . $order : '';
    $condition = stripslashes($condition);
    $condition = str_replace('##', '%', $condition);
    if ($showpage) {
        $num = $db->count($table, $condition, $tag_expires ? $tag_expires : $CFG['db_expires']);
        $pages = $catid ? listpages(get_cat($catid), $num, $page, $pagesize) : pages($num, $page, $pagesize);
    } else {
        if ($group) {
            $condition .= ' GROUP BY ' . $group;
        }
    }
    if ($page < 2 && strpos($parameter, '&page=') !== false) {
        $db_cache = 'CACHE';
        $tag_expires = $CFG['tag_expires'];
    }
    if ($template == 'null') {
        $db_cache = 'CACHE';
    }
    $query = "SELECT " . $fields . " FROM " . $table . " WHERE " . $condition . $order . " LIMIT " . $offset . "," . $pagesize;
    if ($debug) {
        echo $parameter . '<br/>' . $query . '<br/>';
    }
    $tags = $catids = $CATS = array();
    $result = $db->query($query, $db_cache, $tag_expires);
    while ($r = $db->fetch_array($result)) {
        if ($moduleid == 4 && isset($r['company'])) {
            $r['alt'] = $r['companyname'] = $r['company'];
            if ($length) {
                $r['company'] = dsubstr($r['company'], $length);
            }
        }
        if (isset($r['title'])) {
            $r['title'] = str_replace('"', '&quot;', trim($r['title']));
            $r['alt'] = $r['title'];
            if ($length) {
                $r['title'] = dsubstr($r['title'], $length);
            }
            if (isset($r['style']) && $r['style']) {
                $r['title'] = set_style($r['title'], $r['style']);
            }
        }
        if ($lazy && isset($r['thumb']) && $r['thumb']) {
            $r['thumb'] = DT_SKIN . 'image/lazy.gif" class="lazy" original="' . $r['thumb'];
        }
        if (isset($r['introduce']) && $introduce) {
            $r['introduce'] = dsubstr($r['introduce'], $introduce);
        }
        if (isset($r['linkurl']) && $r['linkurl'] && $moduleid > 4 && strpos($r['linkurl'], '://') === false) {
            $r['linkurl'] = $MODULE[$moduleid]['linkurl'] . $r['linkurl'];
        }
        if ($showcat && $moduleid > 4 && isset($r['catid'])) {
            $catids[$r['catid']] = $r['catid'];
        }
        $tags[] = $r;
    }
    $db->free_result($result);
    if ($showcat && $moduleid > 4 && $catids) {
        $result = $db->query("SELECT catid,catname,linkurl FROM {$db->pre}category WHERE catid IN (" . implode(',', $catids) . ")");
        while ($r = $db->fetch_array($result)) {
            $CATS[$r['catid']] = $r;
        }
        if ($CATS) {
            foreach ($tags as $k => $v) {
                $tags[$k]['catname'] = $v['catid'] ? $CATS[$v['catid']]['catname'] : '';
                $tags[$k]['caturl'] = $v['catid'] ? $MODULE[$moduleid]['linkurl'] . $CATS[$v['catid']]['linkurl'] : '';
            }
        }
    }
    if ($template == 'null') {
        return $tags;
    }
    if ($tag_cache) {
        ob_start();
        include template($template, $dir);
        $contents = ob_get_contents();
        ob_clean();
        file_put($TCF, '<!--' . ($DT_TIME + $tag_expires) . '-->' . $contents);
        echo $contents;
    } else {
        include template($template, $dir);
    }
}
Example #18
0
 if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
     //echo "<tr>";
     //echo "<td>";
     $qtty + $waste_barcode[$name_cat];
     //echo " UNIT </td>";
     //echo "<td>";
     get_item_name($name_cat);
     // echo "</td>";
     // echo '<td>';
     get_weight_qtty($ref_sell, $name_cat) + $waste_barcode_weight[$name_cat];
     // echo "</td>";
     //  echo "<td>".$name_cat."</td>";
     //  echo  "</tr>";
     $sum_qtty = get_weight_qtty($ref_sell, $name_cat);
     +$waste_barcode[$name_cat];
     $cat = get_cat($name_cat);
     $weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
 } else {
     $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
     $cust = add_db($customer1);
     while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
         $i++;
         //if($tab[$rek["id_test"]]<'1')
         //{
         //here we count unige barcode waste and add to array
         if ($rek['quantity'] > 0) {
             $index = $rek['type_item'];
             $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
             // echo " <BR /> ";
             //$waste_barcode[$index]+=$rek['quantity'];
             // $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
Example #19
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
require 'common.inc.php';
if ($moduleid < 4) {
    $moduleid = 4;
}
$pid = isset($pid) ? intval($pid) : 0;
if ($pid) {
    $P = get_cat($pid);
    $back_link = 'category.php?moduleid=' . $moduleid . '&pid=' . $P['parentid'];
} else {
    $back_link = mobileurl($moduleid);
}
$lists = get_maincat($pid, $moduleid);
$head_title = $MOD['name'] . $DT['seo_delimiter'] . $head_title;
include template('category', 'mobile');
if (DT_CHARSET != 'UTF-8') {
    toutf8();
}
Example #20
0
 function update($itemid)
 {
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     $item['itemid'] = $itemid;
     if ($item['template'] == 'show-ebook' || $item['template'] == 'show-ebookfull') {
         if (strpos($item['filepath'], '/') === false) {
             $filepath = 'E' . $itemid . '/index.html';
             $update .= ",filepath='{$filepath}'";
         }
     }
     $linkurl = itemurl($item);
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
Example #21
0
 function update($itemid)
 {
     $item = $this->db->get_one("SELECT * FROM {$this->table} WHERE itemid={$itemid}");
     $update = '';
     $keyword = $item['title'] . ',' . strip_tags(cat_pos(get_cat($item['catid']), ','));
     if ($keyword != $item['keyword']) {
         $keyword = str_replace("//", '', addslashes($keyword));
         $update .= ",keyword='{$keyword}'";
     }
     $item['itemid'] = $itemid;
     $linkurl = isset($item['domain']) && $item['domain'] ? $item['domain'] : ($item['islink'] ? $item['linkurl'] : itemurl($item));
     if ($linkurl != $item['linkurl']) {
         $update .= ",linkurl='{$linkurl}'";
     }
     if ($update) {
         $this->db->query("UPDATE {$this->table} SET " . substr($update, 1) . " WHERE itemid={$itemid}");
     }
 }
Example #22
0
  <link href="style/css.css" rel="stylesheet" type="text/css" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Магазин</title>
</head>

  <body>
  
    <table align="center" width="900" cellpadding="0" cellspacing="0" border="0" id="main-table">
      <tr>
      	<td>
          <div id="header"></div>
          <div id="menu">
            <div><a href="index.php">Главная</a></div>
            
            <?php 
$cat = get_cat();
?>
            <?php 
foreach ($cat as $item) {
    ?>
            
            <div><a href="index.php?view=cat&cat_id=<?php 
    echo $item['cat_id'];
    ?>
"><?php 
    echo $item['name'];
    ?>
</a></div>
            
            <?php 
}
Example #23
0
     $tname = '选择信息';
     if ($mid) {
         $table = get_table($mid);
         $condition = 'status=3';
         if ($keyword) {
             $condition .= " AND keyword LIKE '%{$keyword}%'";
         }
         if ($catid) {
             $condition .= $CAT['child'] ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}";
         }
         $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$condition}");
         $items = $r['num'];
         $pages = pages($items, $page, $pagesize);
         $result = $db->query("SELECT * FROM {$table} WHERE {$condition} ORDER BY addtime DESC LIMIT {$offset},{$pagesize}");
         while ($r = $db->fetch_array($result)) {
             $C = get_cat($r['catid']);
             $r['caturl'] = $MODULE[$mid]['linkurl'] . $C['linkurl'];
             $r['catname'] = $C['catname'];
             $r['adddate'] = timetodate($r['addtime'], 5);
             $r['editdate'] = timetodate($r['edittime'], 5);
             $r['alt'] = $r['title'];
             $r['title'] = set_style($r['title'], $r['style']);
             if (strpos($r['linkurl'], '://') === false) {
                 $r['linkurl'] = $MODULE[$mid]['linkurl'] . $r['linkurl'];
             }
             $lists[] = $r;
         }
         $tname = $MODULE[$mid]['name'] . '列表';
     }
     include tpl('item_batch', $module);
 }
Example #24
0
// End PNphpBB2 Module
require $phpbb_root_path . 'includes/prune.' . $phpEx;
require $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
//
// Get the forum ID for pruning
//
if (isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL])) {
    $forum_id = isset($_POST[POST_FORUM_URL]) ? $_POST[POST_FORUM_URL] : $_GET[POST_FORUM_URL];
    // Begin PNphpBB2 Categories Hierarchie Mod
    $cat_id = -1;
    if (substr($forum_id, 0, 1) == 'C') {
        $cat_id = intval(substr($forum_id, 1));
    }
    $forum_sql = '';
    if ($cat_id > -1) {
        $catrows = get_cat($cat_id);
        $catids = array();
        for ($i = 0; $i < count($catrows); $i++) {
            $catids[] = $catrows[$i]['cat_id'];
        }
        $s_cat = implode(', ', $catids);
        if ($s_cat != '') {
            $forum_sql = " AND f.cat_id in ({$s_cat})";
        }
    } else {
        // End PNphpBB2 Categories Hierarchie Mod
        if ($forum_id == -1) {
            $forum_sql = '';
        } else {
            $forum_id = intval($forum_id);
            $forum_sql = "AND forum_id = {$forum_id}";
Example #25
0
function itemurl($item, $page = 0)
{
    global $DT, $MOD, $L;
    if ($MOD['show_html'] && $item['filepath']) {
        if ($page === 0) {
            return $item['filepath'];
        }
        $ext = file_ext($item['filepath']);
        return str_replace('.' . $ext, '_' . $page . '.' . $ext, $item['filepath']);
    }
    include DT_ROOT . '/api/url.inc.php';
    $file_ext = $DT['file_ext'];
    $index = $DT['index'];
    $itemid = $item['itemid'];
    $title = file_vname($item['title']);
    $addtime = $item['addtime'];
    $catid = $item['catid'];
    $year = date('Y', $addtime);
    $month = date('m', $addtime);
    $day = date('d', $addtime);
    $prefix = $MOD['htm_item_prefix'];
    $urlid = $MOD['show_html'] ? $MOD['htm_item_urlid'] : $MOD['php_item_urlid'];
    $ext = $MOD['show_html'] ? 'htm' : 'php';
    $alloc = dalloc($itemid);
    $url = $urls[$ext]['item'][$urlid];
    $url = $page ? $url['page'] : $url['index'];
    if (strpos($url, 'cat') !== false && $catid) {
        $cate = get_cat($catid);
        $catdir = $cate['catdir'];
        $catname = $cate['catname'];
    }
    eval("\$itemurl = \"{$url}\";");
    if (substr($itemurl, 0, 1) == '/') {
        $itemurl = substr($itemurl, 1);
    }
    return $itemurl;
}
Example #26
0
}
?>
&nbsp;最多可添加 <strong class="f_red"><?php 
echo $MOD['cate_max'];
?>
</strong> 个主营行业
<br/><select name="cates" id="cates" size="2" style="height:100px;width:380px;margin-top:5px;">
<?php 
if (is_array($cates)) {
    foreach ($cates as $c) {
        ?>
<option value="<?php 
        echo $c;
        ?>
"><?php 
        echo strip_tags(cat_pos(get_cat($c), '/'));
        ?>
</option>
<?php 
    }
}
?>
</select>
<input type="hidden" name="member[catid]" value="<?php 
echo $catid;
?>
" id="catid"/><br/>
<span id="dcatid" class="f_red"></span>
</td>
</tr>
<tr>
Example #27
0
     message($L['edit_refuse']);
 }
 if ($MG['edit_limit'] && $DT_TIME - $item['addtime'] > $MG['edit_limit'] * 86400) {
     message(lang($L['edit_limit'], array($MG['edit_limit'])));
 }
 if ($submit) {
     if ($item['islink']) {
         $post['islink'] = 1;
     } else {
         if (isset($post['islink'])) {
             unset($post['islink']);
         }
     }
     //$post['clear_link'] = $MOD['clear_link'];
     if ($do->pass($post)) {
         $CAT = get_cat($post['catid']);
         if (!$CAT || !check_group($_groupid, $CAT['group_add'])) {
             dalert(lang($L['group_add'], array($CAT['catname'])));
         }
         $post['addtime'] = timetodate($item['addtime']);
         $post['level'] = $item['level'];
         $post['fee'] = $item['fee'];
         $post['style'] = $item['style'];
         $post['template'] = $item['template'];
         $post['filepath'] = $item['filepath'];
         $post['note'] = $item['note'];
         $need_check = $MOD['check_add'] == 2 ? $MG['check'] : $MOD['check_add'];
         $post['status'] = get_status($item['status'], $need_check);
         $post['hits'] = $item['hits'];
         $post['save_remotepic'] = $MOD['save_remotepic'] ? 1 : 0;
         $post['clear_link'] = $MOD['clear_link'] ? 1 : 0;
Example #28
0
<?php

defined("CATALOG") or die("Access denied");
include 'models/main_model.php';
$categories = get_cat();
$categories_tree = map_tree($categories);
$categories_menu = categories_to_string($categories_tree);
// получение страниц меню
$pages = get_pages();
check_remember();
Example #29
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if (!$MOD['show_html'] || !$itemid) {
    return false;
}
$item = $db->get_one("SELECT * FROM {$table} WHERE itemid={$itemid}");
if (!$item || $item['status'] < 3 || $item['islink'] > 0) {
    return false;
}
extract($item);
$CAT = get_cat($catid);
$content_table = content_table($moduleid, $itemid, $MOD['split'], $table_data);
$t = $db->get_one("SELECT content FROM {$content_table} WHERE itemid={$itemid}");
$content = $t['content'];
if ($lazy) {
    $content = img_lazy($content);
}
$CP = $MOD['cat_property'] && $CAT['property'];
if ($CP) {
    require_once DT_ROOT . '/include/property.func.php';
    $options = property_option($catid);
    $values = property_value($moduleid, $itemid);
}
$adddate = timetodate($addtime, 3);
$editdate = timetodate($edittime, 3);
if ($voteid) {
    $voteid = explode(' ', $voteid);
}
if ($fromurl) {
    $fromurl = fix_link($fromurl);
Example #30
0
<td class="tl">主营行业:</td>
<td colspan="3">
	<?php 
    $catids = explode(',', substr($catid, 1, -1));
    ?>
	<table cellpadding="2" cellspacing="2" width="100%">
	<?php 
    foreach ($catids as $i => $c) {
        ?>
	<?php 
        if ($i % 3 == 0) {
            echo '<tr>';
        }
        ?>
	<td width="33%"><?php 
        echo cat_pos(get_cat($c), ' / ', '_blank');
        ?>
</td>
	<?php 
        if ($i % 3 == 2) {
            echo '</tr>';
        }
        ?>
	<?php 
    }
    ?>
	</table>
</td>
</tr>
<?php 
}