function module_comment_edit() { global $global, $smarty; $obj = new comment(); $obj->set_where('com_id = ' . $global['id']); $one = $obj->get_one(); $one['channel'] = ''; $one['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { if ($list[$i]['cha_id'] == $one['com_channel_id']) { $one['channel'] = $list[$i]['cha_code']; $original = $list[$i]['cha_code']; if ($list[$i]['cha_original'] != 0) { for ($j = 0; $j < count($list); $j++) { if ($list[$i]['cha_original'] == $list[$j]['cha_id']) { $original = $list[$j]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $one['title'] = get_data($table, $one['com_page_id'], substr($table, 0, 3) . '_title'); } } $smarty->assign('comment', $one); }
function module_set() { global $global, $smarty; $smarty->assign('data_username', get_varia('data_username')); $smarty->assign('data_password', get_varia('data_password')); $obj = new channel(); $channel = $obj->get_list(); $smarty->assign('channel', $channel); $obj = new varia(); $obj->set_where("var_name = 'data_cat'"); $list = $obj->get_list(); if (count($list)) { for ($i = 0; $i < count($list); $i++) { $arr = explode('|', $list[$i]['var_value']); $cat_setting[$i]['varia_id'] = $list[$i]['var_id']; $cat_setting[$i]['server_id'] = $arr[0]; $cat_setting[$i]['server_name'] = $arr[1]; $cat_setting[$i]['channel_id'] = $arr[2]; $cat_setting[$i]['cat_id'] = $arr[3]; } } else { $cat_setting = array(); } $smarty->assign('cat_setting', $cat_setting); $cat_list = array(); for ($i = 0; $i < count($cat_setting); $i++) { $obj = new cat_art(); $obj->set_where('cat_channel_id = ' . $cat_setting[$i]['channel_id']); $arr = $obj->get_list(); if (count($arr) > 0) { $cat_list[$cat_setting[$i]['server_id']] = $obj->set_cat_order($arr); } } $smarty->assign('cat_list', $cat_list); }
function __construct() { parent::__construct(); $this->mTimenow = time() * 1000; if (!$this->input['debug']) { header('Content-Type: application/vnd.apple.mpegurl'); } $channel_stream = $this->input['channel_stream']; if ($channel_stream) { $tmp = explode('_', $channel_stream); $this->input['channel'] = $tmp[0]; $this->input['stream'] = $tmp[1]; } $channel_id = addslashes($this->input['channel']); if (!@(include CACHE_DIR . 'channel/' . $channel_id . '.php')) { $this->db = hg_ConnectDB(); include_once CUR_CONF_PATH . 'lib/channel.class.php'; $mChannel = new channel(); $mChannel->cache_channel($channel_id); @(include CACHE_DIR . 'channel/' . $channel_id . '.php'); } if (!$channel_info['channel']) { $this->errorOutput('NO_CHANNEL_NAME'); } if (!$channel_info['channel']['status']) { $this->errorOutput('CHANNEL_STOP'); } $this->mChannelinfo = $channel_info; if ($this->input['stream']) { if (!array_key_exists($this->input['stream'], $this->mChannelinfo['stream'])) { $this->errorOutput('NO_STREAM_NAME'); } } }
function module_comment_sheet() { global $global, $smarty; $obj = new comment(); $obj->set_page_size(10); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['channel'] = ''; $sheet[$i]['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($j = 0; $j < count($list); $j++) { if ($list[$j]['cha_id'] == $sheet[$i]['com_channel_id']) { $sheet[$i]['channel'] = $list[$j]['cha_code']; $original = $list[$j]['cha_code']; if ($list[$j]['cha_original'] != 0) { for ($k = 0; $k < count($list); $k++) { if ($list[$j]['cha_original'] == $list[$k]['cha_id']) { $original = $list[$k]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $sheet[$i]['title'] = get_data($table, $sheet[$i]['com_page_id'], substr($table, 0, 3) . '_title'); } } } $smarty->assign('comment', $sheet); }
function add_lang() { global $smarty, $lang; $chinese_name = post('chinese_name'); $foreign_name = post('foreign_name'); $pack_name = post('pack_name'); $short_name = post('short_name'); $index_entrance = post('index_entrance'); $admin_entrance = post('admin_entrance'); if ($chinese_name != '' && $foreign_name != '' && $pack_name != '' && $index_entrance != '' && $admin_entrance != '' && $index_entrance != 'index.php' && $admin_entrance != 'admin.php') { $var_value = $pack_name . '{v}' . $index_entrance . '{v}' . $admin_entrance . '{v}' . $chinese_name . '{v}' . $foreign_name; $obj = new varia(); $obj->add_var_value('languages', $var_value); $site = get_site_info(); $obj->add_var_value('site_title', $site['title'], $pack_name); $obj->add_var_value('site_name', $site['name'], $pack_name); $obj->add_var_value('site_record', $site['record'], $pack_name); $obj->add_var_value('site_tech', $site['tech'], $pack_name); $obj->add_var_value('site_keywords', $site['keywords'], $pack_name); $obj->add_var_value('site_description', $site['description'], $pack_name); $obj->add_var_value('notice', '', $pack_name, true); $obj->add_var_value('service_code', '', $pack_name, true); $obj->add_var_value('user_agreement', '', $pack_name, true); $obj = new channel(); $obj->set_where('cha_original = 0'); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $obj->clear_value(); $obj->set_value('cha_lang', $pack_name); $obj->set_value('cha_code', $list[$i]['cha_code']); $obj->set_value('cha_name', $list[$i]['cha_name']); $obj->set_value('cha_original', $list[$i]['cha_original']); $obj->add(); } if (!file_exists('languages/' . $pack_name)) { copy_dir('languages/' . S_LANG, 'languages/' . $pack_name); } if (S_MULTILINGUAL) { $file = file_get_contents('admin/index.txt'); $file = str_replace('{$pack_name}', $pack_name, $file); $file = str_replace('{$index_entrance}', $index_entrance, $file); $file = str_replace('{$admin_entrance}', $admin_entrance, $file); file_put_contents($index_entrance, $file); $file = file_get_contents('admin/admin.txt'); $file = str_replace('{$pack_name}', $pack_name, $file); $file = str_replace('{$index_entrance}', $index_entrance, $file); $file = str_replace('{$admin_entrance}', $admin_entrance, $file); file_put_contents($admin_entrance, $file); } $info_text = '添加语言成功'; } else { $info_text = '的输入不合法,添加语言失败'; } $smarty->assign('info_text', $info_text); $smarty->assign('link_text', $lang['return_list']); $smarty->assign('link_href', url(array('channel' => 'file', 'mod' => 'lang_lists'))); }
function module_tailor_cat_add() { global $global, $smarty; $obj = new channel(); $channel = $obj->get_list(); $smarty->assign('channel', $channel); $cat_list = array(); $obj = new cat_art(); $obj->set_where('cat_channel_id = 1'); $arr = $obj->get_list(); if (count($arr) > 0) { $cat_list = $obj->set_cat_order($arr); } $smarty->assign('cat_list', $cat_list); }
function module_channel_add() { global $smarty; $obj = new channel(); $obj->set_where("cha_original = 0"); $smarty->assign('original', $obj->get_list()); $arr = array(); $obj = new channel(); $obj->set_where("cha_original <> 0"); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $list[$i]['original'] = get_data('channel', $list[$i]['cha_original'], 'cha_code'); } $smarty->assign('channel', $list); }
function get_channel_title() { global $global, $lang; $return = ''; if ($global['url'] != '') { $arr = explode('/', $global['url']); $str = $arr[1]; $obj = new channel(); $obj->set_where("cha_code = '{$str}'"); $one = $obj->get_one(); if (count($one)) { $return = $one['cha_name']; } elseif (isset($lang['channel_' . $str])) { $return = $lang['channel_' . $str]; } } return $return; }
public function get_shield_zone() { $channel_id = $this->input['channel_code']; $dates = $this->input['dates']; if (!$dates) { $dates = date('Y-m-d'); } if (!@(include CACHE_DIR . 'channel/' . $channel_id . '.php')) { $this->db = hg_ConnectDB(); include_once CUR_CONF_PATH . 'lib/channel.class.php'; $mChannel = new channel(); $mChannel->cache_channel($channel_id); @(include CACHE_DIR . 'channel/' . $channel_id . '.php'); } if (!$channel_info['channel']) { $this->errorOutput('NO_CHANNEL_NAME'); } if (!$channel_info['channel']['status']) { $this->errorOutput('CHANNEL_STOP'); } $program_shield_dir = $this->settings['program_shield_dir'] ? $this->settings['program_shield_dir'] : 'program_shield'; $dir = $dates; $cache_file = CACHE_DIR . $program_shield_dir . '/' . $dir . '/' . $channel_info['channel']['code'] . '.php'; if (!@(include $cache_file)) { $this->db = hg_ConnectDB(); include_once CUR_CONF_PATH . 'lib/program_shield.class.php'; $mProgramShield = new programShield(); $mProgramShield->cache_program_shield($channel_info['channel']['id'], $dates, $channel_info['channel']['code']); include $cache_file; } if (!$program_shield_zone) { $program_shield_zone = array(); } foreach ($program_shield_zone as $v) { $this->addItem($v); } $this->output(); }
function module_pic_lists() { global $smarty; $list_public = get_file_list('images'); $smarty->assign('list_public', $list_public); $list_editor = get_folder_list('images/editor'); $smarty->assign('list_editor', $list_editor); $k = 0; $lists = array(); $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $arr = get_folder_list('images/' . $list[$i]['cha_code']); if (count($arr)) { $k++; $lists[$k]['channel'] = $list[$i]['cha_code']; $lists[$k]['name'] = $list[$i]['cha_name']; $lists[$k]['folder'] = $arr; } } $smarty->assign('lists', $lists); $smarty->assign('host', $_SERVER['HTTP_HOST']); }
function edit_channel_name() { global $smarty; for ($i = 0; $i < count($_POST['cha_id']); $i++) { $cha_name = strict($_POST['cha_name'][$i]); $cha_id = strict($_POST['cha_id'][$i]); $obj = new channel(); $obj->set_value('cha_name', $cha_name); $obj->set_where('cha_id = ' . $cha_id); $obj->edit(); } $smarty->assign('info_text', '修改频道标题成功'); $smarty->assign('link_text', '返回上一页'); $smarty->assign('link_href', url(array('channel' => 'super', 'mod' => 'channel_name'))); }
| that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id$ */ require_once 'pear-database-channel.php'; $channels = channel::listActive(); $inactive_channels = array(); if (auth_check('pear.admin')) { $inactive_channels = channel::listInactive(); } response_header("Channels", false, '<link rel="alternate" type="application/xbel+xml" href="xbel.php" title="Channel list as XBEL" />'); $tabs = array("List" => array("url" => "/channels/index.php", "title" => "List Sites."), "Add Site" => array("url" => "/channels/add.php", "title" => "Add your site.")); ?> <h1>Channels</h1> <?php print_tabbed_navigation($tabs); ?> <h2>What's that?</h2> <p>A number of third-party sites make it possible to install their software package using the new <a href="/manual/en/guide.migrating.channels.php">channels</a>
function do_del_channel($channel_id) { //判断频道是否已存在 $obj = new channel(); $obj->set_where(''); $obj->set_where("cha_id = {$channel_id}"); $channel = $obj->get_one(); if (count($channel)) { $cha_code = $channel['cha_code']; $obj->del(); } else { return 0; } //删除前台导航(导航管理) $obj = new varia(); $obj->set_where("var_name = 'nav_stage_" . $cha_code . "'"); $obj->del(); //删除后台导航(导航管理) $obj->set_where(''); $obj->set_where("var_name = 'nav_admin_" . $cha_code . "'"); $obj->del(); //删除后台导航菜单 $obj = new menu(); $obj->set_where("men_type = '{$cha_code}'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_header'"); $obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-add/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-cat_list/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-att_list/'"); $obj->del(); //删除前台导航菜单 $obj = new menu(); $obj->set_where("men_type = 'header'"); $obj->set_where("men_url = '" . $cha_code . "/'"); $obj->del(); //删除分类 $obj = new cat_art(); $obj->set_where(''); $obj->set_where("cat_channel_id = {$channel_id}"); $obj->del(); //删除内容 $obj = new article(); $obj->set_where(''); $obj->set_where("art_channel_id = {$channel_id}"); $obj->del(); //删除属性 $obj = new att_art(); $obj->set_where(''); $obj->set_where("att_channel_id = {$channel_id}"); $obj->del(); //删除语言包 $path = 'languages/' . S_LANG . '/admin/' . $cha_code . '.txt'; if (file_exists($path)) { unlink($path); } $path = 'languages/' . S_LANG . '/index/' . $cha_code . '.txt'; if (file_exists($path)) { unlink($path); } //修改伪静态文件 $path = 'admin/module/basic/htaccess.txt'; if (file_exists($path)) { $str = file_get_contents($path); $rule = "\n" . 'RewriteRule ^' . $cha_code . '/(.*)$ index.php?/' . $cha_code . '/$1'; $str = str_replace($rule, '', $str); file_put_contents($path, $str); } return 1; }
/** * 返回日志分类名称 */ public function get_typeid() { $array = channel::get_channel(); //pecho($array); return $array[$this->typeid]['name']; }
/** * 获取频道信息 */ private function get_channel() { include_once ROOT_PATH . 'lib/class/channel.class.php'; $channel = new channel(); $page = isset($this->input['pp']) ? intval($this->input['pp']) : 0; $count = isset($this->input['count']) ? intval($this->input['count']) : 4; $channel_info = $channel->get_channels($page, $count); $this->tpl->addVar('channel_info', $channel_info); }
channel::validate($req, $chan); if (channel::exists($project_name->getValue())) { throw new Exception("Already exists"); } $text = sprintf("[Channels] Please activate %s (%s) on the channel index.", $project_name->getValue(), $project_link->getValue()); $from = sprintf('"%s" <%s>', $contact_name->getValue(), $contact_email->getValue()); $logger = new Damblan_Log(); $observer = new Damblan_Log_Mail(); $observer->setRecipients(PEAR_WEBMASTER_EMAIL); $observer->setHeader("From", $from); $observer->setHeader("Subject", "Channel link submission"); $logger->attach($observer); $logger->log($text); // Add the channel to the DB, but not yet activated channel::add($project_name->getValue()); channel::edit($project_name->getValue(), $project_label->getValue(), $project_link->getValue(), $contact_name->getValue(), $contact_email->getValue()); echo "<div class=\"success\">Thanks for your submission. It will "; echo "be reviewed as soon as possible.</div>\n"; } catch (Exception $exception) { echo '<div class="errors">'; switch ($exception->getMessage()) { case "Invalid channel site": case "Empty channel.xml": echo "The submitted URL does not "; echo "appear to point to a valid channel site. You will "; echo "have to make sure that <tt>/channel.xml</tt> at least "; echo "exists and is valid."; default: echo $exception->getMessage(); break; }
/** * 添加关系 */ public static final function append() { $error = array(); $online = front::online(); $get = array('s_type' => isset($_GET['s_type']) ? $_GET['s_type'] : '', 't_type' => isset($_GET['t_type']) ? $_GET['t_type'] : '', 's_id' => isset($_GET['s_id']) ? (int) $_GET['s_id'] : '0', 't_id' => isset($_GET['t_id']) ? (int) $_GET['t_id'] : '0'); $s_list = null; if ($get['s_type'] == 'channel') { $s_list = channel::get_channel_select(0, 0, $get['s_id'], null, null); } elseif ($get['s_type'] == 'address') { $s_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } elseif ($get['s_type'] == 'book') { $s_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } elseif ($get['s_type'] == 'diary') { $s_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } elseif ($get['s_type'] == 'doc') { $s_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } elseif ($get['s_type'] == 'site') { $s_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } elseif ($get['s_type'] == 'user') { $s_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name')); if ($s_lists) { $s_list = make_option($s_lists, $get['s_id']); } } else { } $t_list = null; if ($get['t_type'] == 'channel') { $t_list = channel::get_channel_select(0, 0, $get['t_id'], null, null); } elseif ($get['t_type'] == 'address') { $t_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } elseif ($get['t_type'] == 'book') { $t_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } elseif ($get['t_type'] == 'diary') { $t_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } elseif ($get['t_type'] == 'doc') { $t_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } elseif ($get['t_type'] == 'site') { $t_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } elseif ($get['t_type'] == 'user') { $t_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name')); if ($t_lists) { $t_list = make_option($t_lists, $get['t_id']); } } else { } // 表单处理 while (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') { // 数据消毒 $post = array('s_type' => isset($_POST['s_type']) ? $_POST['s_type'] : '', 't_type' => isset($_POST['t_type']) ? $_POST['t_type'] : '', 's_id' => isset($_POST['s_id']) ? (int) $_POST['s_id'] : '0', 't_id' => isset($_POST['t_id']) ? (int) $_POST['t_id'] : '0', 'user_id' => $online->user_id); if (!$post['s_type']) { $error['s_type'] = '请选择源类型'; } if (!$post['t_type']) { $error['t_type'] = '请选择目标类型'; } if (!$post['s_id']) { $error['s_id'] = '请选择源内容'; } if (!$post['t_id']) { $error['t_id'] = '请选目标内容'; } if (!$error['t_id']) { if ($post['s_type'] == $post['t_type'] && $post['s_id'] == $post['t_id']) { $error['t_id'] = '不能和自己关联'; } } if (!$error['t_id']) { $related_id = self::selects('related_id', null, array('user_id' => $online->user_id, 's_id' => $post['s_id'], 's_type' => $post['s_type'], 't_id' => $post['t_id'], 't_type' => $post['t_type']), null, array('column' => 'related_id')); if (!$related_id) { $related_id = self::selects('related_id', null, array('user_id' => $online->user_id, 's_id' => $post['t_id'], 's_type' => $post['t_type'], 't_id' => $post['s_id'], 't_type' => $post['s_type']), null, array('column' => 'related_id')); } if ($related_id) { $error['t_id'] = '目标内容已经关联,请重新选择'; } } if (!empty($error)) { break; } // 数据入库 $related = new self(); $related->related_id = null; $related->struct($post); $related->insert(); $error = '添加成功'; front::view2('error.tpl', compact('error')); return; } $types = array('address' => '地址', 'book' => '账本', 'channel' => '分类', 'diary' => '日志', 'doc' => '文章', 'site' => '网址', 'user' => '用户'); front::view2(__CLASS__ . '.' . 'form.tpl', compact('post', 'get', 'error', 'types', 's_list', 't_list')); }
function get_nav($pid) { if (!$pid) { return; } //$pinfo = self::selects(null, null, array('channel_id'=>$pid),array(),array('assoc|table=channel'=>null)); $path = $pinfo['path']; $channel = new channel(); $channel->channel_id = $pid; $channel->select(); //$path = preg_replace('/[0]+/is','',$pinfo['path']);//当前id也在path里。 $path = trim($channel->path, ','); if (!$path) { self::update_path($pid); return self::get_nav($pid); } $paths = explode(',', $path); $paths = array_map('intval', $paths); //pecho($pid); //pecho($paths); //if($path[count($path)]!=$pid)$path.=','.$pid; //$sql = "SELECT * FROM channel WHERE channel_id IN($path)"; //$pinfos = self::selects($sql,null,true,null,array(null,'assoc'=>null)); $pinfos = self::selects(null, null, array('channel_id' => explode(',', $path)), array(), array(null, 'assoc|table=channel' => null)); foreach ($pinfos as $k => $v) { if ($v['channel_id'] != $pid) { $nav .= '<a href="?go=channel&do=detail&channel_id=' . $v['channel_id'] . '">' . $v['name'] . '</a>»'; } else { $nav .= '<strong>' . $v['name'] . '</strong>'; } } return $nav; }
public static final function left() { $tree = channel::tree(); front::view2(__CLASS__ . '.' . __FUNCTION__ . '.tpl', compact('tree')); }
/** * 返回网址分类名称 */ public function get_typeid() { return channel::get_one($this->typeid, 'name'); }
function module_channel_name() { global $smarty; $obj = new channel(); $smarty->assign('channel', $obj->get_list()); }
/** * 返回日志分类名称 */ public function get_typeid() { return channel::get_one($this->typeid, 'name'); //$array = channel::get_channel(); //pecho($array); //return $array [$this->typeid]['name']; }
$url = new Net_URL2($project_name->getValue()); try { $req = new HTTP_Request2(); $dir = explode("/", $url->getPath()); if (!empty($dir)) { array_pop($dir); } $dir[] = 'channel.xml'; $url->setPath(implode("/", $dir)); $req->setURL($url->getURL()); channel::validate($req, $chan); channel::edit($channel['name'], $project_label->getValue(), $project_link->getValue(), $contact_name->getValue(), $contact_email->getValue()); if ($is_active->getValue()) { channel::activate($channel['name']); } else { channel::deactivate($channel['name']); } echo "<div class=\"success\">Changes saved</div>\n"; } catch (Exception $exception) { echo '<div class="errors">'; switch ($exception->getMessage()) { case "Invalid channel site": case "Empty channel.xml": echo "The submitted URL does not "; echo "appear to point to a valid channel site. You will "; echo "have to make sure that <tt>/channel.xml</tt> at least "; echo "exists and is valid."; break; default: echo $exception->getMessage(); break;
| Copyright (c) 2005 The PEAR Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id: index.php 310104 2011-04-09 15:38:46Z clockwerx $ */ require_once 'pear-database-channel.php'; $channels = channel::listActive(); header('Content-type: application/xbel+xml'); echo '<?xml version="1.0"?>' . "\n"; ?> <xbel version="1.0"> <?php foreach ($channels as $channel) { ?> <bookmark href="<?php print $channel['project_link']; ?> "> <title><?php print htmlentities($channel['name']); ?>
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $this->validate($request, ['area_id' => 'required', 'enrollment_id' => 'required', 'distributor_id' => 'required', 'client_id' => 'required', 'channel_id' => 'required', 'customer_id' => 'required', 'region_id' => 'required', 'agency_id' => 'required', 'store_name' => 'required', 'store_id' => 'required']); // $diff_items = array_diff( $channel_items, $store_items ); // $same_items = array_intersect( $channel_items, $store_items ); // $add_store_items = ChannelItem::select('item_id', // 'item_type_id', // 'ig', // 'fso_multiplier', // 'min_stock', // 'ig_updated', // 'osa_tagged', // 'npi_tagged' ) // ->whereIn('item_id',$diff_items) // ->where('channel_id',$request->channel_id) // ->get(); // foreach ($add_store_items as &$data) { // $data->store_id = $id; // } // $delete = StoreItem::where('store_id',$id)->whereNotIn('item_id',$same_items)->delete(); // foreach ($add_store_items as $data) { // $check[] = StoreItem::firstOrCreate([ // 'store_id' => $data->store_id, // 'item_id' => $data->item_id, // 'item_type_id' => $data->item_type_id, // 'ig' => $data->ig, // 'fso_multiplier' => $data->fso_multiplier, // 'min_stock' => $data->min_stock, // 'ig_updated' => $data->ig_updated, // 'osa_tagged' => $data->npi_tagged ]); // } $store = Store::findOrFail($id); //for mkl $mkl_store_items = StoreItem::where('store_id', $id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray(); //get all the item from store mkl $mkl_channel_items = ChannelItem::where('channel_id', $request->channel_id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray(); //for assortment $assortment_store_items = StoreItem::where('store_id', $id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray(); //get all the item from store assortment $assortment_channel_items = ChannelItem::where('channel_id', $request->channel_id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray(); //for mkl foreach ($mkl_store_items as $value) { if (!in_array($value, $mkl_channel_items)) { $delete = StoreItem::where('store_id', $id)->where('item_type_id', 1)->where('item_id', $value)->delete(); } } $mkl_remaining_items = StoreItem::where('store_id', $id)->where('item_type_id', 1)->get()->pluck('item_id')->toArray(); foreach ($mkl_channel_items as $value) { if (!in_array($value, $mkl_remaining_items)) { $data = ChannelItem::where('item_id', $value)->where('channel_id', $request->channel_id)->where('item_type_id', 1)->first(); StoreItem::firstOrCreate(['store_id' => $id, 'item_id' => $data->item_id, 'item_type_id' => $data->item_type_id, 'ig' => $data->ig, 'fso_multiplier' => $data->fso_multiplier, 'min_stock' => $data->min_stock, 'ig_updated' => $data->ig_updated, 'osa_tagged' => $data->npi_tagged]); } } //for assortment foreach ($assortment_store_items as $value) { if (!in_array($value, $assortment_channel_items)) { $delete = StoreItem::where('store_id', $id)->where('item_type_id', 2)->where('item_id', $value)->delete(); } } $assortment_remaining_items = StoreItem::where('store_id', $id)->where('item_type_id', 2)->get()->pluck('item_id')->toArray(); foreach ($assortment_channel_items as $value) { if (!in_array($value, $assortment_remaining_items)) { $data = ChannelItem::where('item_id', $value)->where('channel_id', $request->channel_id)->where('item_type_id', 2)->first(); $w_mkl = StoreItem::where('store_id', $id)->where('item_id', $value)->get(); if (count($w_mkl) == 0) { StoreItem::firstOrCreate(['store_id' => $id, 'item_id' => $data->item_id, 'item_type_id' => $data->item_type_id, 'ig' => $data->ig, 'fso_multiplier' => $data->fso_multiplier, 'min_stock' => $data->min_stock, 'ig_updated' => $data->ig_updated, 'osa_tagged' => $data->npi_tagged]); } } } //end $store->area_id = $request->area_id; $store->enrollment_id = $request->enrollment_id; $store->distributor_id = $request->distributor_id; $store->client_id = $request->client_id; $store->channel_id = $request->channel_id; $store->customer_id = $request->customer_id; $store->region_id = $request->region_id; $store->agency_id = $request->agency_id; $store->store_name = $request->store_name; $store->storeid = $request->store_id; $store->store_code = $request->store_code; $store->store_code_psup = $request->store_code_psup; $store->active = $request->status; $store->update(); \DB::table('store_users')->where('user_id', $request->userid)->where('store_id', $id)->update(['user_id' => $request->user_id]); $store = Store::findOrFail($id); $area = Area::orderBy('area', 'ASC')->lists('area', 'id'); $enrollment = Enrollment::orderBy('enrollment', 'ASC')->lists('enrollment', 'id'); $distributor = Distributor::orderBy('distributor', 'ASC')->lists('distributor', 'id'); $client = Client::orderBy('client_name', 'ASC')->lists('client_name', 'id'); $channel = channel::orderBY('channel_desc', 'ASC')->lists('channel_desc', 'id'); $customer = Customer::orderBy('customer_name', 'ASC')->lists('customer_name', 'id'); $region = Region::orderBy('region_short', 'ASC')->lists('region_short', 'id'); $agency = Agency::orderBy('agency_name', 'ASC')->lists('agency_name', 'id'); $status = ['0' => 'In-active', '1' => 'Active']; $user = StoreUser::where('store_id', $id)->first(); $alluser = User::all()->lists('username', 'id'); $hash = UpdateHash::find(1); if (empty($hash)) { UpdateHash::create(['hash' => \Hash::make(date('Y-m-d H:i:s'))]); } else { $hash->hash = md5(date('Y-m-d H:i:s')); $hash->update(); } Session::flash('flash_class', 'alert-success'); Session::flash('flash_message', 'Store successfully updated.'); return view('store.edit', ['store' => $store, 'area' => $area, 'enrollment' => $enrollment, 'distributor' => $distributor, 'client' => $client, 'channel' => $channel, 'customer' => $customer, 'region' => $region, 'agency' => $agency, 'status' => $status, 'user' => $user, 'alluser' => $alluser]); }