Example #1
0
 function quote()
 {
     global $viewhelper, $pos;
     $this->loadModel("quote");
     $condition = $joins = $id = null;
     $conditions = array();
     $tpl_file = "market/quote";
     $viewhelper->setTitle(L("price_quotes", "tpl"));
     $viewhelper->setPosition(L("price_quotes", "tpl"), "index.php?do=market&action=quote");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (isset($_GET['catid'])) {
         $type_id = intval($_GET['catid']);
         $conditions[] = "Quote.type_id='" . $type_id . "'";
         $viewhelper->setTitle("The industry " . $type_id);
     }
     if (!empty($_GET['title'])) {
         $conditions[] = "title LIKE '%" . pb_addslashes($_GET['title']) . "%'";
     }
     $this->quote->setCondition($conditions);
     $amount = $this->quote->findCount(null, $conditions);
     $fields = "Quote.*,Quote.created AS pubdate,ROUND((Quote.min_price+Quote.max_price)/2,2) AS price";
     $result = $this->quote->findAll($fields, $joins, $conditions, "Quote.id DESC", $pos, $this->displaypg);
     setvar("items", pb_lang_split_recursive($result));
     uaAssign(array("QuoteSearchFrom" => date("Y-m-d", strtotime("last month")), "QuoteSearchTo" => date("Y-m-d")));
     setvar("paging", array('total' => $amount));
     render($tpl_file);
 }
Example #2
0
if (isset($_GET['force_templet_id'])) {
    $member_templet_id = intval($_GET['force_templet_id']);
}
if (!empty($member_templet_id)) {
    $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND status='1' AND id='" . $member_templet_id . "'");
}
if (empty($skin_path_info)) {
    $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND is_default='1'");
    if (empty($skin_path_info)) {
        $skin_path_info = array();
        $skin_path_info[] = "default";
        $skin_path_info[] = "skins/default/";
    }
}
list($skin_path, $skin_dir) = $skin_path_info;
uaAssign(array("SkinName" => $skin_path, "ThemeName" => $skin_path, "SkinPath" => $skin_dir, "COMPANY" => $company->info, "MEMBER" => $member->info));
$smarty->template_dir = PHPB2B_ROOT . "skins" . DS;
$smarty->flash_layout = $skin_path . "/flash";
if (!$smarty->template_exists($skin_path . "flash")) {
    setvar("SkinName", "default");
    $smarty->template_dir = PHPB2B_ROOT . "skins" . DS;
    $smarty->flash_layout = 'default/flash';
}
$smarty->setCompileDir();
$smarty->setCompileDir("skin" . DS . $skin_path . DS);
if (isset($member->info['id'])) {
    $space->setLinks($member->info['id']);
}
$space->setMenu($company->info['cache_spacename'], $space_actions);
$product_types = $pdb->CacheGetArray("SELECT *,id as typeid,name as typename FROM {$tb_prefix}producttypes WHERE company_id=" . $company->info['id']);
//set and get db cache
Example #3
0
        $member->Delete($id);
    }
}
$fields = "id,username,CONCAT(mf.first_name,mf.last_name) AS NickName,mf.reg_ip,last_ip,points,credits,membergroup_id,status,created AS pubdate,last_login,trusttype_ids";
$amount = $member->findCount(null, $conditions);
$page->setPagenav($amount);
$joins[] = "LEFT JOIN {$tb_prefix}memberfields mf ON Member.id=mf.member_id";
$result = $member->findAll($fields, $joins, $conditions, "Member.id DESC ", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $tmp_img = null;
        if ($result[$i]['id'] != $administrator_id) {
            $result[$i]['candelete'] = 1;
        } else {
            $result[$i]['candelete'] = 0;
        }
        if (!empty($result[$i]['trusttype_ids'])) {
            $tmp_str = explode(",", $result[$i]['trusttype_ids']);
            foreach ($tmp_str as $key => $val) {
                $tmp_img .= "<img src='" . URL . STATICURL . "images/icon/" . $G['trusttype'][$val]['avatar'] . "' alt='" . $G['trusttype'][$val]['name'] . "' />";
            }
            $result[$i]['trust_image'] = $tmp_img;
        }
        if (!empty($result[$i]['membergroup_id'])) {
            $result[$i]['group_image'] = URL . STATICURL . "images/group/" . $member_groups[$result[$i]['membergroup_id']]['avatar'];
        }
    }
    setvar("Items", $result);
}
uaAssign(array("MemberStatus" => $typeoption->get_cache_type("check_status"), "ByPages" => $page->pagenav));
template($tpl_file);
Example #4
0
        if (isset($_GET['newstype']['name'])) {
            $conditions[] = "Newstype.name like '%" . trim($_GET['newstype']['name']) . "%'";
        }
    }
    if ($do == "del" && !empty($id)) {
        $newstype->del($id);
    }
    if ($do == "edit") {
        setvar("NewstypeOptions", $newstype->getTypeOptions());
        if (!empty($id)) {
            $res = $newstype->read("*", $id);
            setvar("item", $res);
        }
        $tpl_file = "newstype.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $newstype->findCount(null, $conditions);
$page->setPagenav($amount);
$sql = "SELECT nt.*,(SELECT count(n.id)) AS news_amount FROM " . $tb_prefix . "newstypes nt LEFT JOIN " . $tb_prefix . "newses n ON n.type_id=nt.id GROUP BY nt.id ORDER BY nt.id DESC LIMIT {$page->firstcount},{$page->displaypg}";
$newstype_list = $pdb->GetArray($sql);
setvar("Items", $newstype_list);
uaAssign(array("ByPages" => $page->pagenav));
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $newstype->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
template($tpl_file);
Example #5
0
    } elseif (!empty($_POST['require_membertype'])) {
        $vals['require_membertype'] = 0;
    }
    $vals['tag_ids'] = $tag->setTagId($_POST['data']['tag']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . $id;
            $attachment->insert_new = false;
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        if (!empty($_FILES['pic']['name'])) {
            $attachment->rename_file = "news-" . ($news->getMaxId() + 1);
            $attachment->upload_process();
            $vals['picture'] = $attachment->file_full_url;
        }
        $result = $news->save($vals);
    }
    if (!$result) {
        flash();
    }
}
$amount = $news->findCount(null, $conditions);
$page->setPagenav($amount);
setvar("Items", $news->findAll("*", null, $conditions, "id DESC ", $page->firstcount, $page->displaypg));
uaAssign(array("ByPages" => $page->pagenav, "Newstypes" => $newstype->getCacheTypes()));
template($tpl_file);
Example #6
0
 */
define('IN_PBADMIN', TRUE);
if (empty($_COOKIE[$cookiepre . 'admin']) || !$_COOKIE[$cookiepre . 'admin']) {
    echo "<script language='javascript'>top.location.href='login.php';</script>";
    exit;
} else {
    uses("adminfield");
    $adminer = new Adminfields();
    $tAdminInfo = authcode($_COOKIE[$cookiepre . 'admin'], "DECODE");
    $tAdminInfo = explode("\n", $tAdminInfo);
    $current_adminer_id = $tAdminInfo[0];
    $current_adminer = $tAdminInfo[1];
    $current_pass = $tAdminInfo[2];
    $adminer->loadsession($current_adminer_id, pb_get_client_ip("str"), $cfg_checkip);
    $adminer_info = $adminer->info;
    uaAssign(array("current_adminer" => $current_adminer, "current_adminer_id" => $current_adminer_id));
}
$sections = array('admin', 'message', 'adminmenu');
$smarty->configLoad('default.conf', $sections);
require PHPB2B_ROOT . 'phpb2b_version.php';
$ADODB_CACHE_DIR = DATA_PATH . 'dbcache';
$smarty->template_dir = PHPB2B_ROOT . "templates/admin/";
$smarty->assign("admin_theme_path", "../templates/admin/");
$smarty->setCompileDir($smarty->getCompileDir() . "pb-admin" . DS);
$smarty->flash_layout = "flash";
$smarty->assign("addParams", $viewhelper->addParams);
$smarty->assign("today_timestamp", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
function size_info($fileSize)
{
    $size = sprintf("%u", $fileSize);
    if ($size == 0) {
Example #7
0
$time_offset = isset($_PB_CACHE['setting']['time_offset']) ? $_PB_CACHE['setting']['time_offset'] : 0;
$date_format = isset($_PB_CACHE['setting']['date_format']) ? $_PB_CACHE['setting']['date_format'] : "Y-m-d";
$time_now = array('time' => gmdate("{$date_format} H:i", $time_stamp + 3600 * $time_offset), 'offset' => $time_offset >= 0 ? $time_offset == 0 ? '' : '+' . $time_offset : $time_offset);
if (PHP_VERSION > '5.1') {
    //@date_default_timezone_set('Etc/GMT'.($time_offset > 0 ? '-' : '+').(abs($time_offset)));
} else {
    //@putenv("TZ=GMT".$time_now['offset']);
}
$viewhelper = new PbView();
$conditions = null;
$pb_userinfo = pb_get_member_info();
if ($pb_userinfo) {
    $pb_user = $pb_userinfo;
    $pb_user = pb_addslashes($pb_user);
    uaAssign($pb_userinfo);
}
uaAssign(array('SiteUrl' => URL, 'Charset' => $charset, 'AppLanguage' => $app_lang));
uaAssign($_PB_CACHE['setting']);
$pre_length = strlen($cookiepre);
foreach ($_COOKIE as $key => $val) {
    if (substr($key, 0, $pre_length) == $cookiepre) {
        $_UCOOKIE[substr($key, $pre_length)] = MAGIC_QUOTES_GPC ? $val : pb_addslashes($val);
    }
}
$pre_refer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
if ($gzipcompress && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
} else {
    $gzipcompress = 0;
    ob_start();
}
Example #8
0
     } else {
         $service_interation = intval(($time_stamp - $memberinfo['service_start_date']) / $total_days * 100);
     }
     setvar("service_days", $service_interation > 100 ? 100 : $service_interation);
     $service_info = true;
 }
 if (isset($service_interation)) {
     if ($service_interation >= 100) {
         $group_info = $pdb->GetRow("SELECT default_live_time,after_live_time FROM {$tb_prefix}membergroups WHERE id=" . $membergroup_id);
         $membergroup_id = $group_info['after_live_time'];
         $time_add = $membergroup->getServiceEndtime($group_info['default_live_time']);
         //		$pdb->Execute("UPDATE {$tb_prefix}members SET membergroup_id='".$group_info['after_live_time']."',service_start_date='".$time_stamp."',service_end_date='".$time_add."' WHERE id=".$the_memberid);
         $pdb->Execute("UPDATE {$tb_prefix}members SET membergroup_id='" . $group_info['after_live_time'] . "' WHERE id=" . $the_memberid);
     }
 }
 uaAssign(array("LastLogin" => date("Y-m-d H:i", $memberinfo['last_login'])));
 $offer_count = $pdb->GetArray("SELECT count(id) AS amount,type_id AS typeid FROM {$tb_prefix}trades WHERE member_id=" . $the_memberid . " GROUP BY type_id");
 $offer_stat = array();
 $types = $trade->getTradeTypes();
 if (!empty($offer_count)) {
     foreach ($offer_count as $offer_key => $offer_val) {
         $offer_stat[$types[$offer_val['typeid']]] = $offer_val['amount'];
     }
     setvar("items_offer", $offer_stat);
 }
 $pm_count = $pdb->GetArray("SELECT count(id) AS amount,type AS typename FROM {$tb_prefix}messages WHERE to_member_id=" . $the_memberid . " GROUP BY type");
 if (!empty($pm_count)) {
     $pm_result = array();
     foreach ($pm_count as $pm_val) {
         $pm_result[$pm_val['typename']] = intval($pm_val['amount']);
     }
Example #9
0
        $vals['expire_days'] = 10;
        $vals['expire_time'] = $time_stamp + 24 * 3600 * $vals['expire_days'];
        $conditions[] = "status='1'";
        $ids = implode(",", $_POST['tradeid']);
        $conditions[] = "id in (" . $ids . ")";
        $condition = implode(" AND ", $conditions);
        $sql = "update " . $trade->getTable() . " set submit_time=" . $time_stamp . ",expire_days=10,expire_time=" . $vals['expire_time'] . " where " . $condition;
        $result = $pdb->Execute($sql);
        if ($result) {
            flash("success");
        } else {
            flash("action_failed");
        }
    }
}
$amount = 0;
$amount = $trade->findCount(null, $conditions);
$page->setPagenav($amount);
$result = $trade->findAll("*", null, $conditions, "Trade.submit_time DESC,Trade.id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['expire_date'] = df($result[$i]['expire_time']);
    }
    setvar("Items", $result);
}
uaAssign(array("ByPages" => $page->getPagenav()));
setvar("OFFER_MODERATE_POINT", $_PB_CACHE['setting']['offer_moderate_point']);
setvar("CheckStatus", $typeoption->get_cache_type("check_status"));
setvar("Amount", $amount);
setvar("TimeStamp", $time_stamp);
template($tpl_file);
Example #10
0
         $service_interation = 1;
     } else {
         $service_interation = intval(($time_stamp - $memberinfo['service_start_date']) / $total_days * 100);
     }
     setvar("service_days", $service_interation > 100 ? 100 : $service_interation);
     $service_info = true;
 }
 if (isset($service_interation)) {
     if ($service_interation >= 100) {
         $group_info = $pdb->GetRow("SELECT default_live_time,after_live_time FROM {$tb_prefix}membergroups WHERE id=" . $membergroup_id);
         $membergroup_id = $group_info['after_live_time'];
         $time_add = $membergroup->getServiceEndtime($group_info['default_live_time']);
         $pdb->Execute("UPDATE {$tb_prefix}members SET membergroup_id='" . $group_info['after_live_time'] . "',service_start_date='" . $time_stamp . "',service_end_date='" . $time_add . "' WHERE id=" . $_SESSION['MemberID']);
     }
 }
 uaAssign(array("UserName" => $memberinfo['first_name'] . $memberinfo['last_name'], "LastLogin" => date("Y-m-d H:i", $memberinfo['last_login'])));
 $offer_count = $pdb->GetArray("SELECT count(id) AS amount,type_id AS typeid FROM {$tb_prefix}trades WHERE member_id=" . $_SESSION['MemberID'] . " GROUP BY type_id");
 $offer_stat = array();
 $types = $trade->getTradeTypes();
 if (!empty($offer_count)) {
     foreach ($offer_count as $offer_key => $offer_val) {
         $offer_stat[$types[$offer_val['typeid']]] = $offer_val['amount'];
     }
     setvar("items_offer", $offer_stat);
 }
 $pm_count = $pdb->GetArray("SELECT count(id) AS amount,type AS typename FROM {$tb_prefix}messages WHERE to_member_id=" . $_SESSION['MemberID'] . " GROUP BY type");
 if (!empty($pm_count)) {
     $pm_result = array();
     foreach ($pm_count as $pm_val) {
         $pm_result[$pm_val['typename']] = intval($pm_val['amount']);
     }
Example #11
0
/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2218 $
 */
function pb_sendmail($to_users = array(), $subject, $template = null, $body = null, $redirect_url = null)
{
    global $charset, $smarty, $theme_name, $_PB_CACHE;
    require_once LIB_PATH . "phpmailer/class.phpmailer.php";
    require CACHE_LANG_PATH . 'lang_emails.php';
    $content = null;
    $mail = new PHPMailer();
    $result = false;
    $logdata['created'] = time();
    if (!empty($_PB_CACHE['setting']['mail'])) {
        extract(unserialize($_PB_CACHE['setting']['mail']));
    }
    if ($send_mail == 2) {
        $mail->IsSMTP();
        $mail->Host = $smtp_server;
        $mail->Port = $smtp_port;
        if ($smtp_auth) {
            $mail->SMTPAuth = true;
        }
        if (!empty($auth_protocol)) {
            $mail->SMTPSecure = $auth_protocol;
        }
        $mail->Username = $auth_username;
        $mail->Password = $auth_password;
    } else {
        $mail->IsMail();
    }
    $mail->IsHTML(true);
    $mail->CharSet = $charset;
    $mail->Encoding = "base64";
    $mail->From = $mail_from;
    $mail->FromName = empty($mail_fromwho) ? $_PB_CACHE['setting']['site_name'] : $mail_fromwho;
    $mail->Subject = $subject;
    $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
    // optional, comment out and test
    $tpl_file = $theme_name . "/elements/emails/" . $template . $smarty->tpl_ext;
    if (!empty($template) && $smarty->template_exists($tpl_file)) {
        if (!empty($arrTemplate)) {
            uaAssign($arrTemplate);
        }
        uaAssign($_PB_CACHE['setting']);
        $content = $smarty->fetch($tpl_file);
    } elseif (!empty($body)) {
        $content = $body;
    }
    $mail->MsgHTML($content);
    if (!empty($to_users)) {
        if (!is_array($to_users[0])) {
            $mail->AddAddress($to_users[0], $to_users[1]);
            $result = $mail->Send();
        } elseif (is_array($to_users[0])) {
            foreach ($to_users as $key => $val) {
                $mail->AddAddress($val[0], $val[1]);
                $result = $mail->Send();
                $mail->ClearAddresses();
            }
        }
    }
    if ($mail->error_count > 0) {
        if (class_exists("Logs")) {
            $log = new Logs();
        } else {
            uses("log");
            $log = new Logs();
        }
        $logdata['handle_type'] = "error";
        $logdata['source_module'] = "sendmail";
        $logdata['description'] = $mail->ErrorInfo;
        $log->Add($logdata);
        return false;
    }
    if (!empty($redirect_url)) {
        pheader("Location:" . $redirect_url);
    } else {
        return $result;
    }
}
Example #12
0
    if ($do == "edit") {
        if (!empty($id)) {
            $sql = "SELECT c.*,m.username,m.membergroup_id,m.credits FROM {$tb_prefix}companies c LEFT JOIN {$tb_prefix}members m ON c.member_id=m.id WHERE c.id=" . $id;
            $res = $pdb->GetRow($sql);
            $r1 = $industry->disSubOptions($res['industry_id'], "industry_");
            $r2 = $area->disSubOptions($res['area_id'], "area_");
            $res = am($res, $r1, $r2);
            setvar("item", $res);
            $selected['properties'] = explode(",", $res['manage_type']);
            setvar("SelectedManageType", $selected['properties']);
            $selected['markets'] = explode(",", $res['main_market']);
            setvar("SelectedMarket", $selected['markets']);
        }
        uaAssign(array("CompanyProperty" => $_PB_CACHE['economic_type'], "ManageTypes" => $_PB_CACHE['manage_type'], "MainMarkets" => $_PB_CACHE['main_market'], "CompanyFunds" => $_PB_CACHE['reg_fund'], "CompanyAnual" => $_PB_CACHE['year_annual'], "LinkmanPositions" => $_PB_CACHE['position'], "EmployeeAmounts" => $_PB_CACHE['employee_amount'], "Genders" => $_PB_CACHE['gender']));
        $tpl_file = "company.edit";
        template($tpl_file);
        exit;
    }
}
$fields = "Company.id,m.space_name,Company.cache_spacename,m.membergroup_id,m.credits,member_id,m.username,Company.name AS CompanyName,Company.status AS CompanyStatus,Company.created AS pubdate,Company.if_commend,Company.area_id,industry_id,cache_credits";
$total_amount = $pdb->CacheGetOne(120, "SELECT COUNT(id) AS amount FROM " . $tb_prefix . "companies WHERE status='0'");
$amount = $company->findCount(null, $conditions, "Company.id");
$page->setPagenav($amount);
$joins = array();
$joins[] = "LEFT JOIN {$tb_prefix}members m ON m.id=Company.member_id";
if (empty($lists)) {
    $lists = $company->findAll($fields, $joins, $conditions, "Company.id DESC", $page->firstcount, $page->displaypg);
}
setvar("Items", $lists);
uaAssign(array("ByPages" => $page->pagenav, "TotalAmount" => $total_amount));
template($tpl_file);
Example #13
0
        }
    }
    if (($do == "del" || $_GET['act'] == "del") && !empty($id)) {
        $res = $product->read("id", $id);
        if ($res) {
            if (!$product->del($_GET['id'], $conditions)) {
                flash();
            }
        } else {
            flash("data_not_exists");
        }
    }
}
if (isset($_GET['typeid']) && !empty($_GET['typeid'])) {
    $conditions[] = "producttype_id = " . $_GET['typeid'];
}
$amount = $product->findCount(null, $conditions, "Product.id");
$page->setPagenav($amount);
$result = $product->findAll("sort_id,id,name,picture,content,created,status,state", null, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg);
if ($result) {
    $i_count = count($result);
    for ($i = 0; $i < $i_count; $i++) {
        $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '../', 'small');
    }
}
setvar("Items", $result);
setvar("nlink", $page->nextpage_link);
setvar("plink", $page->previouspage_link);
setvar("CheckStatus", explode(",", L('product_status', 'tpl')));
uaAssign(array("pagenav" => $page->getPagenav()));
template($tpl_file);
Example #14
0
 public function init()
 {
     global $subdomain_support, $rewrite_able, $pdb, $time_stamp, $tb_prefix, $absolute_uri, $attachment_url, $G, $viewhelper;
     //espcial done for multi arrTemplate
     $this->loadModel("space");
     $sections = 'space';
     $this->view->configLoad('default.conf', $sections);
     if (isset($_GET['userid'])) {
         $this->userid = trim(htmlspecialchars($_GET['userid']));
     }
     if ($subdomain_support && $rewrite_able) {
         $hosts = explode($subdomain_support, pb_getenv('HTTP_HOST'));
         if ($hosts[0] != "www") {
             //				$this->userid = trim($hosts[0]);
         }
     }
     $G['membergroup'] = cache_read("membergroup");
     using("member", "company");
     $member = new Members();
     $company = new Companies();
     $space_name = '';
     if (empty($theme_name)) {
         $theme_name = "default";
         $style_name = isset($G['setting']['theme']) && !empty($G['setting']['theme']) ? $G['setting']['theme'] : "default";
         $ADODB_CACHE_DIR = DATA_PATH . 'dbcache';
     }
     $this->view->assign("theme_img_path", "templates/" . $theme_name . "/");
     $this->view->assign('ThemeName', $theme_name);
     $cache_data = $push_data = array();
     if (!empty($this->userid)) {
         $userid = $this->userid;
         $member->setInfoBySpaceName($this->userid);
         if (!empty($member->info['id'])) {
             $this->member_id = $member->info['id'];
             $company->setInfoByMemberId($member->info['id']);
         } else {
             $company->setInfoBySpaceName($this->userid);
         }
         $push_data['company'] = $company->info;
         $this->company_id = $company->info['id'];
         $push_data['member'] = $member->info;
     } elseif (!empty($_GET['id'])) {
         $id = intval($_GET['id']);
         $company->id = $this->company_id = $id;
         $company->setInfoById($id);
         if (!empty($company->info['member_id'])) {
             $member->id = $this->member_id = $company->info['member_id'];
         }
         $push_data['company'] = $company->info;
         $push_data['member'] = $member->info;
     }
     if (isset($company->info['status']) && $company->info['status'] === 0) {
         header_sent(L('company_checking'));
         exit;
     } elseif (empty($company->info) || !$company->info) {
         header_sent(L('data_not_exists'));
         exit;
     }
     $cache_data = $pdb->GetRow("SELECT data2 AS style FROM {$tb_prefix}spacecaches WHERE company_id='" . $company->info['id'] . "'");
     if (isset($cache_data['style'])) {
         $skin_extra_style = $cache_data['style'];
     }
     if (!empty($company->info['created'])) {
         $time_tmp = $time_stamp - $company->info['created'];
         $company->info['year_sep'] = $time_tmp = ceil($time_tmp / (3600 * 24 * 365));
     }
     if (empty($company->info['email'])) {
         $company->info['email'] = $G['setting']['service_email'];
     }
     if (empty($company->info['picture'])) {
         $company->info['logo'] = $absolute_uri . pb_get_attachmenturl('', '', 'big');
     } else {
         $company->info['logo'] = $absolute_uri . $attachment_url . $company->info['picture'];
     }
     $company->info = pb_lang_split_recursive($company->info);
     $company->info['description'] = nl2br(strip_tags($company->info['description']));
     $is_set_default_skins = false;
     $member_templet_id = $member->info['templet_id'];
     if (isset($_GET['force_templet_id'])) {
         $member_templet_id = intval($_GET['force_templet_id']);
     }
     if (!empty($member_templet_id)) {
         $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND status='1' AND id='" . $member_templet_id . "'");
     }
     if (empty($skin_path_info)) {
         $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND is_default='1'");
         if (empty($skin_path_info)) {
             $is_set_default_skins = true;
         }
     } elseif (!is_dir(PHPB2B_ROOT . $skin_path_info)) {
         $is_set_default_skins = true;
     }
     if ($is_set_default_skins) {
         $skin_path_info = array();
         $skin_path_info[] = "default";
         $skin_path_info[] = "templates/skins/default/";
     }
     list($skin_path, $skin_dir) = $skin_path_info;
     if (strpos($skin_dir, "templates") === false) {
         $skin_dir = "templates/" . $skin_dir;
         //for 4.3 upgrade from 4.3 below,begin 2012.10
     }
     $this->skin_path = $skin_path;
     $this->skin_dir = $skin_dir;
     uaAssign(array("SkinName" => $skin_path, "ThemeName" => $skin_path, "SkinPath" => $skin_dir, "COMPANY" => $company->info, "MEMBER" => $member->info));
     $this->view->setTemplateDir(PHPB2B_ROOT . "templates" . DS . "skins" . DS);
     $this->view->setCompileDir(DATA_PATH . "templates_c" . DS . $this->lang . DS . "skin" . DS . $skin_path . DS);
     if (isset($member->info['id'])) {
         $this->setLinks($member->info['id']);
     }
     $this->setMenu($company->info['cache_spacename'], $this->spaceModules);
     $product_types = $pdb->GetArray("SELECT *,id as typeid,name as typename FROM {$tb_prefix}producttypes WHERE company_id=" . $company->info['id']);
     //set and get db cache
     setvar("ProductTypes", $product_types);
     $group_info = array();
     $group_info['year'] = $time_tmp;
     if (!empty($member->info['membergroup_id']['name'])) {
         $group_info['name'] = $G['membergroup'][$member->info['membergroup_id']]['name'];
     } else {
         $group_info['name'] = L("undefined_image", "tpl");
     }
     if (!empty($member->info['membergroup_id']['avatar'])) {
         $group_info['image'] = $absolute_uri . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar'];
     } else {
         $group_info['image'] = $absolute_uri . STATICURL . "images/group/formal.gif";
     }
     setvar("GROUP", $group_info);
     //for old version
     if (isset($member->info['membergroup_id']['name'])) {
         setvar("GroupName", $G['membergroup'][$member->info['membergroup_id']]['name']);
     }
     if (isset($member->info['membergroup_id']['avatar'])) {
         setvar("GroupImage", $absolute_uri . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar']);
     }
     setvar("Menus", $this->getMenu());
     setvar("Links", $this->getLinks());
     $space_url = $this->rewrite($company->info['cache_spacename'], $company->info['id']);
     setvar("space_url", $space_url);
     setvar("SpaceUrl", $absolute_uri . $skin_dir);
     $space_extra_style = '';
     setvar("SpaceExtraStyle", $space_extra_style);
     if (!empty($skin_extra_style)) {
         $space_extra_style = $absolute_uri . $skin_dir . "styles/" . $skin_extra_style . "/";
         setvar("SpaceExtraStyle", $space_extra_style);
     }
     setvar("BASEMAP", $absolute_uri . $skin_dir);
     $pdb->Execute("UPDATE {$tb_prefix}companies SET clicked=clicked+1 WHERE id='" . $company->info['id'] . "'");
     if (!empty($arrTemplate)) {
         $this->view->assign($arrTemplate);
     }
     if (!empty($_GET['module'])) {
         $this->module = trim($_GET['module']);
     }
     $this->view->assign("cur", "space_" . $this->module);
 }
Example #15
0
            }
            $info = $pdb->GetRow("SELECT * FROM " . $tb_prefix . "quotes WHERE id=" . $id);
            $pdb->Execute("UPDATE " . $tb_prefix . "quotes SET hits=hits+1 WHERE id=" . $id);
            $info['pubdate'] = df($info['created']);
            $info['clicked'] = $info['hits'];
            setvar("item", $info);
            $tpl_file = "detail.default";
            render($tpl_file, true);
            break;
        case "search":
            if (!empty($_GET['title'])) {
                $conditions[] = "title LIKE '%" . pb_addslashes($_GET['title']) . "%'";
            }
            break;
        default:
            break;
    }
}
if (isset($_GET['catid'])) {
    $type_id = intval($_GET['catid']);
    $conditions[] = "Quote.type_id='" . $type_id . "'";
    $viewhelper->setTitle("The industry " . $type_id);
}
$quote->setCondition($conditions);
$amount = $quote->findCount(null, $conditions);
$fields = "Quote.*,Quote.created AS pubdate,ROUND((Quote.min_price+Quote.max_price)/2,2) AS price";
$result = $quote->findAll($fields, $joins, $conditions, "Quote.id DESC", $pos, $limit);
setvar("items", $result);
uaAssign(array("QuoteSearchFrom" => date("Y-m-d", strtotime("last month")), "QuoteSearchTo" => date("Y-m-d")));
setvar("paging", array('total' => $amount));
render($tpl_file);
Example #16
0
}
$js_language = $app_lang;
if ($show_ajax) {
    $show_ajax = 1;
}
$_G = array('SiteUrl' => URL, 'show_ajax' => $show_ajax, 'charset' => $charset, 'AppLanguage' => $app_lang, 'WebRootUrl' => $absolute_uri, 'TemplateDir' => 'templates', 'JsLanguage' => $js_language, 'cookiepre' => $cookiepre, 'cookiedomain' => $cookiedomain, 'cookiepath' => $cookiepath);
uaAssign($_G);
if (!empty($_PB_CACHE['setting']['site_theme_styles'])) {
    $_PB_CACHE['setting']['site_theme_styles'] = unserialize($_PB_CACHE['setting']['site_theme_styles']);
}
//at c, use $G;v, $_G.
$G['setting'] = pb_lang_split_recursive($_PB_CACHE['setting']);
$G['setting']['nav_id'] = '';
//Todo:
setvar("_G", $G['setting']);
uaAssign($G['setting']);
if (!MAGIC_QUOTES_GPC) {
    $_GET = pb_addslashes($_GET);
    $_POST = pb_addslashes($_POST);
    $_COOKIE = pb_addslashes($_COOKIE);
    $_SERVER = pb_addslashes($_SERVER);
}
$G = am($G, $_GET, $_POST);
$viewhelper = new PbView();
$pre_refer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
if ($gzipcompress && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
} else {
    $gzipcompress = 0;
    ob_start();
}