コード例 #1
0
ファイル: dict.php プロジェクト: reboxhost/phpb2b
        if (!empty($id)) {
            $item = $dict->read("*", $id);
            setvar("item", $item);
        }
        if (!empty($item['dicttype_id'])) {
            setvar("dicttypeOptions", $dicttype_option = $dicttype->getTypeOptions($item['dicttype_id']));
        } else {
            setvar("dicttypeOptions", $dicttype_option = $dicttype->getTypeOptions());
        }
        $tpl_file = "dict.edit";
        template($tpl_file);
        exit;
    }
}
if (isset($_POST['save']) && !empty($_POST['data']['dict'])) {
    $_POST['data']['dict']['word'] = pb_lang_merge($_POST['data']['multi']);
    $vals = $_POST['data']['dict'];
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $dict->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $dict->save($vals);
    }
    if (!$result) {
        flash();
    }
}
コード例 #2
0
ファイル: setting.php プロジェクト: reboxhost/phpb2b
    if (file_put_contents($configfile, $configfiles)) {
        return true;
    } else {
        return false;
    }
}
if (isset($_POST['savebasic'])) {
    $sp_search = array('\\\\"', "\\\\'", "'");
    $sp_replace = array('&', '"', ''');
    $siteurl = $_POST['data']['setting']['site_url'];
    if (!empty($siteurl) && substr($siteurl, -1, 1) != '/') {
        $siteurl .= "/";
    }
    $_POST['data']['setting']['site_url'] = $siteurl;
    if (isset($_POST['data']['multita'])) {
        $_POST['data']['setting']['site_description'] = pb_lang_merge($_POST['data']['multita']);
        if (!empty($_POST['data']['setting']['site_description'])) {
            $_POST['data']['setting']['site_description'] = str_replace($sp_search, $sp_replace, $_POST['data']['setting']['site_description']);
        }
    }
    if (!empty($_POST['data']['setting'])) {
        $updated = $setting->replace($_POST['data']['setting']);
        if ($updated) {
            $cache->writeCache("setting", "setting");
        }
    }
    if ($updated) {
        if (!empty($_POST['data']['setting']['site_url']) && !pb_strcomp($_POST['data']['setting']['site_url'], $absolute_uri)) {
            edit_config(array("absolute_uri" => $_POST['data']['setting']['site_url']));
        }
        flash("success", "setting.php?do=basic");
コード例 #3
0
ファイル: offer_controller.php プロジェクト: reboxhost/phpb2b
 function add()
 {
     global $G;
     require CLASS_PATH . "validation.class.php";
     $validate = new Validation();
     uses("trade", "member", "tradefield", "tag");
     $tag = new Tags();
     $offer = $tradefield = new Tradefields();
     $member = new Members();
     $trade = new Trades();
     if (isset($_POST['visit_post'])) {
         capt_check("capt_post_free");
         pb_submit_check('visit_post');
         $_POST['data']['trade']['title'] = pb_lang_merge($_POST['data']['multi']);
         $trade->setParams();
         $tradefield->setParams();
         $if_title_exists = $trade->findByTitle($trade->params['data']['trade']['title']);
         if (!empty($if_title_exists)) {
             $trade->validationErrors[] = L("semilar_offer_post");
         }
         if (!$validate->notEmpty($trade->params['data']['trade']['title'])) {
             $trade->validationErrors[] = L("title_cant_be_empty");
         }
         $trade->params['expire_days'] = $_POST['expire_days'];
         $if_check = $G['setting']['vis_post_check'];
         $msg = null;
         $words = $trade->dbstuff->GetArray("SELECT * FROM {$trade->table_prefix}words");
         if (!empty($words)) {
             foreach ($words as $word_val) {
                 if (!empty($word_val['title'])) {
                     str_replace($word_val['title'], "***", $trade->params['data']['trade']['title']);
                     str_replace($word_val['title'], "***", $trade->params['data']['trade']['content']);
                 }
             }
             $item['forbid_word'] = implode("\r\n", $tmp_str);
         }
         if ($if_check) {
             $trade->params['data']['trade']['status'] = 0;
             $msg = 'pls_wait_for_check';
         } else {
             $trade->params['data']['trade']['status'] = 1;
             $msg = 'success';
         }
         if (!empty($trade->validationErrors)) {
             setvar("item", am($trade->params['data']['trade'], $tradefield->params['data']['tradefield']));
             setvar("Errors", $validate->show($trade));
             render("offer/post");
         } else {
             $trade->params['data']['trade']['industry_id'] = implode(",", $_POST['industry']['id']);
             $trade->params['data']['trade']['area_id'] = implode(",", $_POST['area']['id']);
             $result = $trade->Add();
             if ($result) {
                 flash($msg);
             } else {
                 flash();
             }
         }
     }
 }
コード例 #4
0
ファイル: offer.php プロジェクト: haojielyb/phpb2b
        $vals['expire_time'] = $time_stamp + 24 * 3600 * $vals['expire_days'];
        $conditions[] = "status='1'";
        $result = $trade->save($vals, "update", $id, null, $conditions);
        if (!$result) {
            flash("action_failed");
        } else {
            flash("success");
        }
    }
}
if (isset($_POST['do']) && !empty($_POST['data']['trade'])) {
    pb_submit_check('data');
    if (!empty($_POST['data']['multi'])) {
        $_POST['data']['trade']['title'] = pb_lang_merge($_POST['data']['multi']);
    }
    $_POST['data']['trade']['content'] = pb_lang_merge($_POST['data']['multita']);
    $res = $_POST['data']['trade'];
    $now_offer_amount = $trade->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid);
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if ($g['offer_check']) {
        $res['status'] = 0;
        $msg = 'msg_wait_check';
    } else {
        $res['status'] = 1;
        $msg = 'success';
    }
    if (!empty($_FILES['pic']['name'])) {
        $attach_id = empty($id) ? "offer-" . $the_memberid . "-" . ($trade->getMaxId() + 1) : "offer-" . $the_memberid . "-" . $id;
        $attachment->rename_file = $attach_id;
コード例 #5
0
ファイル: membergroup.php プロジェクト: reboxhost/phpb2b
require CACHE_COMMON_PATH . "cache_type.php";
uses("membergroup", "typeoption");
$cache = new Caches();
$conditions = array();
$membergroup = new Membergroups();
$typeoption = new Typeoption();
$tpl_file = "membergroup";
setvar("AskAction", $typeoption->get_cache_type("common_option"));
setvar("Membertypes", $_PB_CACHE['membertype']);
if (isset($_POST['updateDefault']) && !empty($_POST['gid'])) {
    $id = intval($_POST['gid'][0]);
    $pdb->Execute("UPDATE {$tb_prefix}membergroups SET is_default='0' WHERE 1");
    $pdb->Execute("UPDATE {$tb_prefix}membergroups SET is_default='1' WHERE id=" . $id);
}
if (isset($_POST['saveauth'])) {
    $_POST['membergroup']['name'] = pb_lang_merge($_POST['data']['multi']);
    $vals = $_POST['membergroup'];
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    $vals['allow_offer'] = bindec($_POST['offer']['allow'] . $_POST['offer']['check']);
    $vals['allow_product'] = bindec($_POST['product']['allow'] . $_POST['product']['check']);
    $vals['allow_job'] = bindec($_POST['job']['allow'] . $_POST['job']['check']);
    $vals['allow_companynews'] = bindec($_POST['companynews']['allow'] . $_POST['companynews']['check']);
    $vals['allow_album'] = bindec($_POST['album']['allow'] . $_POST['album']['check']);
    $vals['allow_market'] = bindec($_POST['market']['allow'] . $_POST['market']['check']);
    $vals['allow_company'] = bindec($_POST['company']['allow'] . $_POST['company']['check']);
    if (!empty($id)) {
        $result = $membergroup->save($vals, "update", $id);
    } else {
        $result = $membergroup->save($vals);
コード例 #6
0
ファイル: cache.class.php プロジェクト: reboxhost/phpb2b
 function getCacheArray($cachename = '', $script = '')
 {
     $conditions = $curdata = '';
     $data = array();
     if (empty($cachename) && !empty($this->cache_name)) {
         $cachename = $this->cache_name;
     }
     switch ($cachename) {
         case 'nav':
             $this->lang_dirname = '';
             $navs = $this->dbstuff->GetArray("SELECT id,name,description,url,target,display_order,highlight FROM {$this->table_prefix}navs  WHERE status=1 ORDER BY display_order ASC");
             $navmns = $_nlink = array();
             if (!empty($navs)) {
                 foreach ($navs as $nav => $nav_val) {
                     $lang_title = $nav_val['name'];
                     $_tmp = pb_lang_split($lang_title, true);
                     foreach ($_tmp as $_nk => $_nv) {
                         $_nlink[$_nk] = '<a href="' . $nav_val['url'] . '" title="' . $_nv . '" ' . parse_highlight($nav_val['highlight']) . '><span>' . $_nv . '</span></a>';
                     }
                     $navmns[$nav_val['id']]['link'] = pb_lang_merge($_nlink);
                     $navmns[$nav_val['id']]['id'] = $nav_val['id'];
                     $navmns[$nav_val['id']]['name'] = $lang_title;
                     $navmns[$nav_val['id']]['url'] = $nav_val['url'];
                     $navmns[$nav_val['id']]['level'] = $nav_val['display_order'];
                 }
                 $data['navs'] = $navmns;
             }
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             break;
         case 'trusttype':
             $this->lang_dirname = '';
             $this->dbstuff->setFetchMode(ADODB_FETCH_ASSOC);
             $conditions = "";
             $sql = "SELECT * FROM {$this->table_prefix}trusttypes ORDER BY display_order ASC,id DESC";
             $result = $this->dbstuff->GetArray($sql);
             foreach ($result as $key => $val) {
                 $result[$key]['avatar'] = $val['image'];
                 unset($result[$key]['description'], $result[$key]['display_order'], $result[$key]['status'], $result[$key]['image']);
                 $data[$val['id']] = $result[$key];
             }
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             break;
         case 'country':
             $this->lang_dirname = '';
             $this->dbstuff->setFetchMode(ADODB_FETCH_ASSOC);
             $conditions = "";
             $sql = "SELECT * FROM {$this->table_prefix}countries ORDER BY display_order ASC,id ASC";
             $result = $this->dbstuff->GetArray($sql);
             foreach ($result as $key => $val) {
                 $result[$key]['image'] = $val['picture'];
                 unset($result[$key]['display_order']);
                 $data[$val['id']] = $result[$key];
             }
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray(pb_lang_split_recursive($data)) . ";\n\n";
             break;
         case 'setting':
             $this->lang_dirname = '';
             $tmp_mail = array();
             $table = 'setting';
             $conditions = "";
             $sql = "SELECT * FROM {$this->table_prefix}settings WHERE type_id IN (0,1)";
             $setting = $this->dbstuff->GetArray($sql);
             foreach ($setting as $key => $val) {
                 //For multi
                 $s_title = $val['valued'];
                 $data[$val['variable']] = $s_title;
             }
             //set sendmail
             $tmp_mail['send_mail'] = $data['send_mail'];
             $tmp_mail['auth_protocol'] = $data['auth_protocol'];
             $tmp_mail['smtp_server'] = $data['smtp_server'];
             $tmp_mail['smtp_port'] = $data['smtp_port'];
             $tmp_mail['smtp_auth'] = $data['smtp_auth'];
             $tmp_mail['mail_from'] = $data['mail_from'];
             $tmp_mail['mail_fromwho'] = $data['mail_fromwho'];
             $tmp_mail['auth_username'] = $data['auth_username'];
             $tmp_mail['auth_password'] = $data['auth_password'];
             $tmp_mail['mail_delimiter'] = $data['mail_delimiter'];
             $tmp_mail['sendmail_silent'] = $data['sendmail_silent'];
             $data['mail'] = serialize($tmp_mail);
             unset($tmp_mail, $data['send_mail'], $data['smtp_server'], $data['smtp_port'], $data['smtp_auth'], $data['mail_from'], $data['mail_fromwho'], $data['auth_username'], $data['auth_password'], $data['mail_delimiter'], $data['sendmail_silent']);
             $data['capt_auth'] = bindec($data['capt_logging'] . $data['capt_register'] . $data['capt_post_free'] . $data['capt_add_market'] . $data['capt_login_admin'] . $data['capt_apply_friendlink'] . $data['capt_service']);
             unset($data['capt_logging'], $data['capt_register'], $data['capt_post_free'], $data['capt_add_market'], $data['capt_login_admin'], $data['capt_apply_friendlink'], $data['capt_service']);
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             break;
         case 'area':
             $this->lang_dirname = '';
             $sql = "select * from {$this->table_prefix}areas a where a.parent_id=0 ORDER by display_order asc";
             $top_areas = $sec_areas = $third_areas = $areas = $total_areas = array();
             $area1 = $this->dbstuff->GetArray($sql);
             $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n";
             $op .= "var data_area = { \n";
             foreach ($area1 as $key => $val) {
                 //For multi
                 $i_title = $val['name'];
                 //					$tmp = unserialize($val['description']);
                 //					if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                 $top_areas[$val['id']] = $total_areas[1][$val['id']] = $i_title;
                 $sql = "select * from {$this->table_prefix}areas a where level=2 AND parent_id=" . $val['id'] . " ORDER by display_order asc";
                 $sec_areas = $this->dbstuff->GetArray($sql);
                 foreach ($sec_areas as $key2 => $val2) {
                     //For multi
                     $i_title = $val2['name'];
                     //						$tmp = unserialize($val2['description']);
                     //						if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                     $third_areas = $this->dbstuff->GetArray("select id,name,parent_id,top_parentid from {$this->table_prefix}areas a where level=3 AND parent_id=" . $val2['id'] . " ORDER by display_order asc");
                     $areas[$val['id']]['sub'][$val2['id']] = $i_title;
                     $total_areas[2][$val2['id']] = $i_title;
                     foreach ($third_areas as $key3 => $val3) {
                         //For multi
                         $i_title = $val3['name'];
                         //							$tmp = unserialize($val3['description']);
                         //							if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                         $areas[$val2['id']]['sub'][$val3['id']] = $total_areas[3][$val3['id']] = $i_title;
                     }
                 }
             }
             $top_areas = pb_lang_split_recursive($this->convert2utf8($top_areas));
             $areas = pb_lang_split_recursive($this->convert2utf8($areas));
             $op .= "'0':" . json_encode($top_areas);
             $tmp_op = array();
             foreach ($top_areas as $js_key => $js_val) {
                 if (isset($areas[$js_key])) {
                     foreach ($areas[$js_key] as $js_key1 => $js_val1) {
                         $tmp_op[] = "'0,{$js_key}':" . json_encode($areas[$js_key]['sub']);
                         foreach ($areas[$js_key]['sub'] as $js_key2 => $js_val2) {
                             if (!empty($areas[$js_key2]['sub'])) {
                                 $tmp_op[] = "'0,{$js_key},{$js_key2}':" . json_encode($areas[$js_key2]['sub']);
                             }
                         }
                     }
                 }
             }
             if (!empty($tmp_op)) {
                 $op .= ",\n";
                 $tmp_op = implode(",\n", $tmp_op);
                 $op .= $tmp_op . "\n}";
             } else {
                 $op .= "\n}";
             }
             $fp = file_put_contents($this->cache_path . "area.js", $op);
             ksort($total_areas);
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($total_areas) . ";\n\n";
             //db cache.
             $data = array();
             $op = "<?php\n";
             $op .= "return ";
             $tmp_level_top = $this->dbstuff->GetArray("SELECT id,name,parent_id,level,url FROM " . $this->table_prefix . "areas WHERE available=1 ORDER BY display_order ASC");
             $data = pb_format_tree($tmp_level_top, 0);
             $op .= $this->evalArray($data);
             unset($data);
             $op .= "\n";
             $op .= "?>";
             $fp = file_put_contents(CACHE_COMMON_PATH . "area.php", $op);
             break;
         case 'industry':
             $this->lang_dirname = '';
             if (!function_exists("smarty_function_the_url")) {
                 require SLUGIN_PATH . "function.the_url.php";
             }
             $sql = "SELECT name,id,name AS title,description FROM {$this->table_prefix}industries i WHERE i.parent_id=0 and available=1 ORDER BY display_order ASC";
             $top_levels = $sec_levels = $third_levels = $datas = $total_datas = array();
             $level1 = $this->dbstuff->GetArray($sql);
             $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n";
             $op .= "var data_industry = { \n";
             foreach ($level1 as $key => $val) {
                 //For multi
                 $i_title = $val['name'];
                 //					$tmp = unserialize($val['description']);
                 //					if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                 $top_levels[$val['id']] = $total_datas[1][$val['id']] = $i_title;
                 $sql = "SELECT id,name,parent_id,top_parentid,name AS title,description FROM {$this->table_prefix}industries t WHERE available=1 AND level=2 AND parent_id=" . $val['id'] . " ORDER BY display_order ASC";
                 $sec_levels = $this->dbstuff->GetArray($sql);
                 foreach ($sec_levels as $key2 => $val2) {
                     //For multi
                     $i_title = $val2['name'];
                     //						$tmp = unserialize($val2['description']);
                     //						if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                     $third_levels = $this->dbstuff->GetArray("SELECT id,name,parent_id,top_parentid,name AS title,description FROM {$this->table_prefix}industries t WHERE available=1 AND level=3 AND parent_id=" . $val2['id'] . " ORDER BY display_order ASC");
                     $datas[$val['id']]['sub'][$val2['id']] = $i_title;
                     $total_datas[2][$val2['id']] = $i_title;
                     foreach ($third_levels as $key3 => $val3) {
                         //For multi
                         $i_title = $val3['name'];
                         //							$tmp = unserialize($val3['description']);
                         //							if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname];
                         $datas[$val2['id']]['sub'][$val3['id']] = $total_datas[3][$val3['id']] = $i_title;
                     }
                 }
             }
             $top_levels = pb_lang_split_recursive($this->convert2utf8($top_levels));
             $datas = pb_lang_split_recursive($this->convert2utf8($datas));
             $op .= "'0':" . json_encode($top_levels);
             $tmp_op = array();
             foreach ($top_levels as $js_key => $js_val) {
                 if (isset($datas[$js_key])) {
                     foreach ($datas[$js_key] as $js_key1 => $js_val1) {
                         $tmp_op[] = "'0,{$js_key}':" . json_encode($datas[$js_key]['sub']);
                         foreach ($datas[$js_key]['sub'] as $js_key2 => $js_val2) {
                             if (!empty($datas[$js_key2]['sub'])) {
                                 $tmp_op[] = "'0,{$js_key},{$js_key2}':" . json_encode($datas[$js_key2]['sub']);
                             }
                         }
                     }
                 }
             }
             if (!empty($tmp_op)) {
                 $op .= ",\n";
                 $tmp_op = implode(",\n", $tmp_op);
                 $op .= $tmp_op . "\n}";
             } else {
                 $op .= "\n}";
             }
             $fp = file_put_contents($this->cache_path . "industry.js", $op);
             unset($op);
             ksort($total_datas);
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($total_datas) . ";\n\n";
             unset($top_levels, $sec_levels, $third_levels, $datas, $total_datas, $op);
             //db cache.
             $data = array();
             $op = "<?php\n";
             $op .= "return ";
             $tmp_level_top = $this->dbstuff->GetArray("SELECT id,name,parent_id,level,url FROM " . $this->table_prefix . "industries WHERE available=1 ORDER BY display_order ASC");
             $data = pb_format_tree($tmp_level_top, 0);
             $op .= $this->evalArray($data);
             unset($data);
             $op .= "\n";
             $op .= "?>";
             $fp = file_put_contents(CACHE_COMMON_PATH . "industry.php", $op);
             break;
         case 'userpage':
             $this->lang_dirname = '';
             $sql = "SELECT id,name,title,url,digest FROM {$this->table_prefix}userpages ORDER BY display_order ASC,id ASC";
             $result = $this->dbstuff->GetArray($sql);
             if (!empty($result)) {
                 $i = 0;
                 foreach ($result as $key => $val) {
                     $data[$i]['id'] = $val['id'];
                     $data[$i]['title'] = $val['title'];
                     $data[$i]['name'] = $val['name'];
                     $data[$i]['digest'] = $val['digest'];
                     if (!empty($val['url'])) {
                         $data[$i]['url'] = $val['url'];
                     } else {
                         $data[$i]['url'] = "";
                     }
                     $i++;
                 }
             }
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             break;
         case 'form':
             $this->lang_dirname = '';
             $form_result = $this->dbstuff->GetArray("SELECT * FROM {$this->table_prefix}forms ORDER BY id ASC");
             if (!empty($form_result)) {
                 foreach ($form_result as $val) {
                     $item_result = $this->dbstuff->GetArray("SELECT * FROM {$this->table_prefix}formitems WHERE id IN (" . $val['items'] . ") ORDER BY id ASC");
                     if (!empty($item_result)) {
                         foreach ($item_result as $val1) {
                             $data[$val['id']][$val1['id']]['id'] = $val1['identifier'];
                             $data[$val['id']][$val1['id']]['label'] = $val1['title'];
                         }
                     }
                 }
                 $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             }
             break;
         case 'membergroup':
             $this->lang_dirname = '';
             $sql = "SELECT * FROM {$this->table_prefix}membergroups mg ORDER BY mg.id DESC";
             $membergroup_result = $this->dbstuff->GetArray($sql);
             if (!empty($membergroup_result)) {
                 foreach ($membergroup_result as $key => $val) {
                     $data[$val['id']]['name'] = $val['name'];
                     $data[$val['id']]['max_offer'] = $val['max_offer'];
                     $data[$val['id']]['type_id'] = $val['membertype_id'];
                     $data[$val['id']]['max_product'] = $val['max_product'];
                     $data[$val['id']]['max_job'] = $val['max_job'];
                     $data[$val['id']]['max_companynews'] = $val['max_companynews'];
                     $data[$val['id']]['max_market'] = $val['max_companynews'];
                     $data[$val['id']]['max_album'] = $val['max_companynews'];
                     $data[$val['id']]['max_producttype'] = $val['max_producttype'];
                     $data[$val['id']]['max_attach_size'] = $val['max_attach_size'];
                     $data[$val['id']]['max_size_perday'] = $val['max_size_perday'];
                     $data[$val['id']]['max_favorite'] = $val['max_favorite'];
                     $data[$val['id']]['type'] = $val['type'];
                     $data[$val['id']]['avatar'] = $val['picture'];
                     $data[$val['id']]['allow_space'] = $val['allow_space'];
                     $tmp_allow = sprintf("%02b", $val['allow_offer']);
                     $data[$val['id']]['offer_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['offer_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_market']);
                     $data[$val['id']]['market_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['market_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_company']);
                     $data[$val['id']]['company_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['company_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_product']);
                     $data[$val['id']]['product_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['product_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_job']);
                     $data[$val['id']]['job_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['job_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_companynews']);
                     $data[$val['id']]['companynews_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['companynews_check'] = intval($tmp_allow[1]);
                     $tmp_allow = sprintf("%02b", $val['allow_album']);
                     $data[$val['id']]['album_allow'] = intval($tmp_allow[0]);
                     $data[$val['id']]['album_check'] = intval($tmp_allow[1]);
                     $data[$val['id']]['auth_level'] = intval($val['exempt']);
                 }
             }
             $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n";
             break;
         case "javascript":
             $this->view->clearConfig();
             $this->view->configLoad("default.conf", "javascript");
             $js_vars = $this->view->getConfigVars();
             //arrTemplate is the language pack
             $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n";
             $op .= "var pb_lang = { \n";
             if (!empty($js_vars)) {
                 foreach ($js_vars as $key => $val) {
                     $val = str_replace("\"", "", $val);
                     $op .= "\t" . strtoupper(trim($key, '_')) . ' : "' . $val . '",';
                     $op .= "\n";
                 }
             }
             $op .= "\tEND : ''\n};";
             $fp = file_put_contents($this->cache_path . "locale.js", $op);
             unset($op);
             break;
         default:
             break;
     }
     return $curdata;
 }
コード例 #7
0
ファイル: membertype.php プロジェクト: reboxhost/phpb2b
foreach ($G['membergroup'] as $key => $val) {
    $membergroups[$key] = $val['name'];
}
setvar("Membergroups", $membergroups);
if (isset($_POST['del']) && !empty($_POST['id'])) {
    $result = $membertype->del($_POST['id']);
    if (!$result) {
        flash();
    } else {
        $cache->updateTypes();
    }
}
if (isset($_POST['save'])) {
    $id = $_POST['id'];
    $_POST['data']['membertype']['name'] = pb_lang_merge($_POST['data']['multi']);
    $_POST['data']['membertype']['description'] = pb_lang_merge($_POST['data']['multita']);
    $vals = $_POST['data']['membertype'];
    if (!empty($id)) {
        $result = $membertype->save($vals, "update", $id);
    } else {
        $result = $membertype->save($vals);
    }
    if (!$result) {
        flash();
    } else {
        $cache->updateTypes();
    }
}
if (isset($_POST['updateDefault']) && !empty($_POST['default_id'])) {
    $vals = array();
    $vals['if_default'] = 1;
コード例 #8
0
ファイル: dicttype.php プロジェクト: reboxhost/phpb2b
    }
    if ($do == "edit") {
        setvar("dicttypeOptions", $dicttype->getTypeOptions());
        if (isset($_GET['id'])) {
            $id = intval($_GET['id']);
            $res = $dicttype->read("*", $id);
            setvar("item", $res);
        }
        $tpl_file = "dicttype.edit";
        template($tpl_file);
        exit;
    }
}
if (isset($_POST['save'])) {
    $vals = array();
    $_POST['data']['dicttype']['name'] = pb_lang_merge($_POST['data']['multi']);
    $vals = $_POST['data']['dicttype'];
    if (!empty($_POST['id'])) {
        $result = $dicttype->save($vals, "update", $_POST['id']);
    } elseif (!empty($vals['name'])) {
        $names = explode("\r\n", $vals['name']);
        $tmp_name = array();
        if (!empty($names)) {
            foreach ($names as $val) {
                $name = $val;
                if (!empty($name)) {
                    $tmp_name[] = "('" . $name . "','" . $vals['parent_id'] . "','" . $vals['display_order'] . "')";
                }
            }
            $values = implode(",", $tmp_name);
            $sql = "INSERT INTO {$tb_prefix}dicttypes (name,parent_id,display_order) VALUES " . $values;
コード例 #9
0
ファイル: userpage.php プロジェクト: reboxhost/phpb2b
$cache = new Caches();
$userpage = new Userpages();
$conditions = null;
$tpl_file = "userpage";
$file = new Files();
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $userpage->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
    $cache->writeCache("userpage", "userpage");
}
if (isset($_POST['save'])) {
    $vals = array();
    $_POST['data']['userpage']['title'] = pb_lang_merge($_POST['data']['multi']);
    $_POST['data']['userpage']['content'] = pb_lang_merge($_POST['data']['multita']);
    $vals = $_POST['data']['userpage'];
    if (!empty($vals['title']) && !empty($vals['name'])) {
        if (!empty($_POST['id'])) {
            $vals['modified'] = $time_stamp;
            $result = $userpage->save($vals, "update", $_POST['id']);
        } else {
            $vals['created'] = $vals['modified'] = $time_stamp;
            $result = $userpage->save($vals);
        }
    }
    if (!$result) {
        flash();
    }
    $cache->writeCache("userpage", "userpage");
}