function get_filters_names($conn)
{
    $filter = array();
    //Reputation Activities
    $filter['act'] = Reputation::get_reputation_activities($conn);
    //Product types
    $product_types = Product_type::get_list($conn);
    $filter['ptype'][0] = _('ANY');
    foreach ($product_types as $ptype) {
        $filter['ptype'][$ptype->get_id()] = $ptype->get_name();
    }
    //Subcategories
    $subcategories = Subcategory::get_list($conn);
    $filter['subcat'][0] = _('ANY');
    foreach ($subcategories as $subc) {
        $filter['subcat'][$subc->get_id()] = $subc->get_name();
    }
    //Categories
    $categories = Category::get_list($conn);
    $filter['cat'][0] = _('ANY');
    foreach ($categories as $cat) {
        $filter['cat'][$cat->get_id()] = $cat->get_name();
    }
    return $filter;
}
Example #2
0
 public function show($product_id, $product_name = '')
 {
     if (!$product_id) {
         echo 'product_show return false';
     }
     array_push($this->data['js_functions'], array('name' => 'home_prodcut_show_init', 'data' => FALSE));
     #!
     $product_category_selected = new Product_category();
     $product_type_selected = new Product_type();
     $product_selected = new Product();
     $nutrition_categories = new Nutrition_category();
     #!
     $product_selected->get_full_info($product_id);
     $product_selected->nutrition->get_full_info();
     #$product_selected->nutrition->convert_to_mera(2);
     $product_type_selected->get_full_info($product_selected->product_type_id);
     $product_type_selected->product->get_full_info();
     $product_category_selected->get_full_info($product_type_selected->product_category_id);
     $nutrition_categories->get_full_info();
     #!
     $meras_available = array('100 gramms');
     foreach ($product_selected->mera as $mera) {
         $meras_available[$mera->join_seq] = $mera->join_name . ' ( ' . $mera->join_value . ' )';
     }
     #!
     $this->data['meras_available'] = $meras_available;
     $this->data['dm_product_category_selected'] = $product_category_selected;
     $this->data['dm_product_type_selected'] = $product_type_selected;
     $this->data['dm_product_selected'] = $product_selected;
     $this->data['dm_nutrition_categories'] = $nutrition_categories;
     #nutritions by selected product
     $this->data['dm_nutritions'] = $product_selected->nutrition;
     $this->data['dm_products'] = $product_type_selected->product;
     array_push($this->data['crumbs'], array('name' => 'home', 'link' => $this->linker->home_page_link()));
     array_push($this->data['crumbs'], array('name' => $product_selected->join_name, 'link' => false));
     #!
     $this->template->load('/templates/main_template', '/products/product_show', $this->data);
 }
Example #3
0
 public function search_result()
 {
     $query_string = 'apple';
     $product_type_names = new Languages_Product_type();
     $product_type = new Product_type();
     $product_type_names->like('name', $query_string, 'after')->get(1);
     #PRODUCT TYPE
     foreach ($product_type_names as $type) {
         $return_arr['product_types'][] = $query_string . '<strong>' . str_ireplace($query_string, '', $type->name) . '</strong>';
     }
     #PRODUCT_by_first_type
     if (isset($product_type_names->all[0])) {
         $product_type->get_full_info($product_type_names->all[0]->id);
         $product_type->product->get_short_info();
         $data['dm_products'] = $product_type->product;
         $return_arr['product_items'] = $this->load->view('search/products/items', $data, true);
     } else {
         $return_arr['product_items'] = array();
     }
     $return_arr['status'] = true;
     print_flex($product_type_names->all[0]);
     $this->output->enable_profiler(true);
     return;
 }
?>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table class="transparent" align="center">
				<tr>
					<td>
<!-- #### STEP 2: Plugin #### -->
						<div id="wizard_2">
						<?php 
$plugin_list = Plugin::get_list($conn, "ORDER BY name");
$none_checked = 'true';
$product_types = Product_type::get_list($conn);
?>
						<input type="hidden" name="plugin_id" id="plugin_id" value="" />
						<input type="hidden" name="type" id="type" value="" />
						<table width="500" class="transparent" align="center">
						    <tr>
								<td class="nobborder center" style='height:48px;'>
									<div style="padding-bottom:10px">
										<?php 
echo _('Choose between ') . "<b>" . _("Event Types Selection") . "</b> " . _("or") . " <b>" . _('Taxonomy') . "</b>";
?>
									</div>
									<div style="padding-bottom:10px">
										<input type="radio" name="plug_type_id" id="plug_type_id" value="0" onclick="change_event_type(0, 'id');" <?php 
echo !$flag_tax ? "checked='checked'" : "";
?>
Example #5
0
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("analysis-menu", "ControlPanelAlarms");
$vars = $_SESSION['_kdb_alarm_vars'];
$plugin_id = $_SESSION['_kdb_alarm_pid'];
$plugin_sid = $_SESSION['_kdb_alarm_psid'];
$docs = 0;
if ($plugin_id != '' && $plugin_sid != '') {
    $db_kdb = new ossim_db();
    $conn_kdb = $db_kdb->connect();
    //Taxonomy
    $ptype = Product_type::get_product_type_by_plugin($conn_kdb, $plugin_id);
    $cat = Category::get_category_subcategory_by_plugin($conn_kdb, $plugin_id, $plugin_sid);
    $keyname = (empty($ptype['id']) ? 0 : $ptype['id']) . "##" . (empty($cat['cid']) ? 0 : $cat['cid']) . "##" . (empty($cat['scid']) ? 0 : $cat['scid']);
    $repository_list['taxonomy'] = Repository::get_repository_linked($conn_kdb, $keyname, 'taxonomy');
    //Directive
    if ($plugin_id == '1505') {
        $repository_list['directive'] = Repository::get_linked_by_directive($conn_kdb, $plugin_sid);
    }
    //Plugin SID
    $keyname = "{$plugin_sid}##{$plugin_id}";
    $repository_list['plugin_sid'] = Repository::get_repository_linked($conn_kdb, $keyname, 'plugin_sid');
    $docs = count($repository_list['directive']) + count($repository_list['plugin_sid']) + count($repository_list['taxonomy']);
    $db_kdb->close($conn_kdb);
}
?>
Example #6
0
 function get_products_list()
 {
     $type_id = (int) $this->input->post('type_id');
     if (!$type_id and !is_numeric($type_id)) {
         echo 'return !';
     }
     $product_type = new Product_type();
     $products = new Product();
     $product_type->get_full_info($type_id);
     $product_type->product->get_full_info();
     $this->data['dm_products'] = $product_type->product;
     $this->load->view('admin/products/sub/show_products_list', $this->data);
 }
Example #7
0
 function run_axaj_proba()
 {
     $product_type_names = new Languages_Product_type();
     $product_type = new Product_type();
     $product_type_names->like('name', 'ch', 'after')->get(5);
     #PRODUCT_by_first_type
     if (isset($product_type_names->all[0])) {
         $product_type->get_full_info($product_type_names->all[0]->id);
         $product_type->product->get_short_info();
         $data['dm_products'] = $product_type->product;
         $return_arr['product_items'] = $this->load->view('search/products/items', $data, true);
     } else {
         $return_arr['product_items'] = array();
     }
     foreach ($product_type->product as $product) {
         print_flex($product->nutrition->data);
         echo dm_get_value_by_field('Protein', $product->nutrition, 'join_name');
         return;
     }
     #print_flex(dm_get_value_by_field('Protein',$product_type->product->nutrition,'join_name'));
 }
Example #8
0
function get_doc_info($conn, $rel)
{
    $name = '';
    $url = '';
    $url_links['host'] = Menu::get_menu_url('/ossim/av_asset/common/views/detail.php?asset_id=KKKK', 'environment', 'assets', 'assets');
    $url_links['net'] = Menu::get_menu_url('/ossim/av_asset/network/view/list.php', 'environment', 'assets', 'networks');
    $url_links['host_group'] = Menu::get_menu_url('/ossim/av_asset/group/view/list.php', 'environment', 'assets', 'asset_groups');
    $url_links['net_group'] = Menu::get_menu_url('/ossim/netgroup/netgroup.php', 'environment', 'assets', 'network_groups');
    $url_links['incident'] = Menu::get_menu_url('/ossim/incidents/incident.php?id=KKKK', 'analysis', 'tickets', 'tickets');
    $url_links['directive'] = Menu::get_menu_url('/ossim/directives/index.php?toggled_dir=KKKK&dir_info=1', 'configuration', 'threat_intelligence', 'directives');
    $url_links['plugin_sid'] = Menu::get_menu_url('/ossim/forensics/base_qry_main.php?clear_allcriteria=1&search=1&sensor=&sip=&plugin=&ossim_risk_a=+&submit=Signature&search_str=KKKK', 'analysis', 'security_events', 'security_events');
    $url_links['taxonomy'] = "";
    $key = $rel['key'];
    switch ($rel['type']) {
        case 'directive':
            $name = $rel['key'];
            break;
        case 'incident':
            $sql = "SELECT title from incident where id=?";
            $params = array($rel['key']);
            $rs = $conn->Execute($sql, $params);
            if (!$rs) {
                $name = _('Unknown');
            } elseif (!$rs->EOF) {
                $name = $rs->fields["title"];
            }
            break;
        case 'plugin_sid':
            $plugin = explode('##', $rel['key']);
            $pid = $plugin[1];
            $sid = $plugin[0];
            if ($pid != '' && $sid != '') {
                $name = Plugin_sid::get_name_by_idsid($conn, $pid, $sid);
                if (!preg_match('/:/', $name)) {
                    $name = Plugin::get_name_by_id($conn, $pid) . ": " . $name;
                }
                $key = $name;
            } else {
                $name = _('Unknown, Please edit this relationship');
                $key = '';
            }
            break;
        case 'host':
        case 'host_group':
        case 'net':
        case 'net_group':
            $field = $rel['type'] == 'host' ? 'hostname' : 'name';
            $sql = "SELECT {$field} as name from " . $rel['type'] . " where id=UNHEX(?)";
            $params = array($rel['key']);
            $rs = $conn->Execute($sql, $params);
            if (!$rs) {
                $name = _('Unknown');
            } elseif (!$rs->EOF) {
                $name = $rs->fields["name"];
            }
            break;
        case 'taxonomy':
            $tax = explode('##', $rel['key']);
            $ptype = intval($tax[0]) != 0 ? Product_type::get_name_by_id($conn, $tax[0]) : _('ANY');
            $cat = intval($tax[1]) != 0 ? Category::get_name_by_id($conn, $tax[1]) : _('ANY');
            $subcat = intval($tax[2]) != 0 ? Subcategory::get_name_by_id($conn, $tax[2]) : _('ANY');
            $name = _('Product Type') . ': ' . $ptype . ', ' . _('Category') . ': ' . $cat . ', ' . _('Subcategory') . ': ' . $subcat;
            break;
        default:
            $name = _('Unknown');
    }
    $url = $url_links[$rel['type']];
    $url = $url != '' ? str_replace('KKKK', $key, $url) : 'javascript:;';
    return array($name, $url);
}