コード例 #1
0
                        $tempPackets = $data[$key]['packets'] - $packets[$row['srcip']][$row['srcport']][$row['dstip']][$row['dstport']][$row['protocol']];
                        $tempBytes = $data[$key]['bytes'] - $bytes[$row['srcip']][$row['srcport']][$row['dstip']][$row['dstport']][$row['protocol']];
                        if ($tempPackets > -1 && $tempBytes > -1) {
                            $data[$key]['packets'] = $tempPackets;
                            $data[$key]['bytes'] = $tempBytes;
                        }
                    }
                }
            }
        }
        $filterPassThru .= "&view=1";
        $viewPassThru = "&view=1";
    }
    // Sort it by the selected order
    if ($_GET['order']) {
        natsort2d($data, $_GET['order']);
        if ($_GET['sort']) {
            if ($_GET['sort'] == "des") {
                $data = array_reverse($data);
            }
        }
    }
}
function natsort2d(&$arrIn, $index = null)
{
    $arrTemp = array();
    $arrOut = array();
    if (is_array($arrIn)) {
        foreach ($arrIn as $key => $value) {
            reset($value);
            $arrTemp[$key] = is_null($index) ? current($value) : $value[$index];
コード例 #2
0
ファイル: index.php プロジェクト: Alien-nick/princeamds-code
function _dkg_init_images_main($path_name, $index)
{
    $query = sprintf("SELECT image_name,thumb_width,\n        thumb_height,image_size,image_date,image_type,\n        thumb_name,image_width,image_height\n\t\tFROM %s\n\t\tWHERE image_dir\n        LIKE '%s' \t", mysql_real_escape_string($GLOBALS['db_table']), mysql_real_escape_string($path_name));
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $files[] = array("image_name" => "" . $row['image_name'] . "", "thumb_width" => "" . $row['thumb_width'] . "", "thumb_height" => "" . $row['thumb_height'] . "", "image_size" => "" . $row['image_size'] . "", "image_date" => "" . $row['image_date'] . "", "image_type" => "" . $row['image_type'] . "", "thumb_name" => "" . $row['thumb_name'] . "", "image_width" => "" . $row['image_width'] . "", "image_height" => "" . $row['image_height'] . "");
    }
    natsort2d($files);
    $total_items = mysql_num_rows($result);
    _dkg_table_set("open");
    $table_item = 0;
    $mark = 0;
    foreach ($files as $value) {
        $table_count = 1;
        while ($table_count <= $total_items) {
            $open = $table_count * $GLOBALS['thumb_row'] - $GLOBALS['thumb_row'];
            $close = $table_count * $GLOBALS['thumb_row'];
            if ($open == $table_item) {
                $mark++;
                _dkg_table_row_group_set("open");
            }
            if ($close == $table_item) {
                _dkg_table_row_group_set("close");
            }
            $table_count++;
        }
        $table_item++;
        _dkg_table_row_group_item_set("open");
        echo "<a href='{$GLOBALS['gal_path']}/{$path_name}/{$value['image_name']}' class='lightview' rel='gallery[kindgirls]' title='{$value['image_name']} :: Resolution:" . $value['image_width'] . 'x' . $value['image_height'] . " | Size: " . round($value['image_size'], 2) . "KB | Date: {$value['image_date']} ' ><img src='{$GLOBALS['thumb_path']}/{$value['thumb_name']}' width='360'  align=center  /></a>";
        echo "<p>\n<a href='{$GLOBALS['gal_path']}/{$path_name}/{$value['image_name']}' class='float-left' />" . _dkg_label_processor($value['image_name'], 24) . "</a>\n";
        _dkg_table_row_group_item_set("close");
    }
    $marker = $mark * $GLOBALS['thumb_row'] - $total_items;
    while ($marker > 0) {
        _dkg_table_row_group_item_set("open");
        _dkg_table_row_group_item_set("close");
        $marker--;
    }
    _dkg_table_set("close");
}
コード例 #3
0
 public function tags_mk_cloud($i_domain_id = NULL, $s_template = "tags", $i_per_page = -1, $b_ignore_paging = true, $b_by_usage = false, $arr_users = array())
 {
     // init and context :
     $s_tpl_tags = "cloud_tags";
     $s_tpl_tag = "cloud_tag";
     $s_tpl_tag_sep = "cloud_tagseparator";
     $s_tpl_tags_empty = "cloud_tags_empty";
     // validate input :
     if (!$arr_users || intval($arr_users) === -1 || strval($arr_users) === 'all' || $arr_users == "Все") {
         $arr_users = array();
     }
     if (is_int($arr_users)) {
         $arr_users = array(intval($arr_users));
     } elseif (is_array($arr_users)) {
         $arr_users = array_map('intval', $arr_users);
     } else {
         $arr_users = array(intval(strval($arr_users)));
     }
     $i_per_page = intval($i_per_page);
     if (!$i_per_page) {
         $i_per_page = 10;
     }
     if ($i_per_page === -1) {
         $b_ignore_paging = true;
     }
     $s_template = strval($s_template);
     if (!strlen($s_template)) {
         $s_template = "tags";
     }
     $i_curr_page = intval(getRequest('p'));
     if ($b_ignore_paging) {
         $i_curr_page = 0;
     }
     // load templates :
     list($tpl_tags, $tpl_tag, $tpl_tag_sep, $tpl_tags_empty) = $this->loadTemplates("content/" . $s_template, $s_tpl_tags, $s_tpl_tag, $s_tpl_tag_sep, $s_tpl_tags_empty);
     // process :
     $max_font_size = 32;
     $min_font_size = 10;
     //
     $s_prefix = '';
     //
     if ($b_by_usage) {
         $o_object_type = umiObjectTypesCollection::getInstance()->getTypeByGUID('root-pages-type');
         $i_tags_field_id = $o_object_type->getFieldId('tags');
         //
         $result = umiObjectProperty::objectsByValue($i_tags_field_id, 'all', true, true, $i_domain_id ? $i_domain_id : -1);
     } else {
         $stat = cmsController::getInstance()->getModule('stat');
         $sStatIncPath = dirname(dirname(dirname(dirname(__FILE__)))) . '/stat/classes';
         if (class_exists("statisticFactory") == false) {
             return;
         }
         $factory = new statisticFactory($sStatIncPath);
         $factory->isValid('allTags');
         $report = $factory->get('allTags');
         if ($i_domain_id) {
             $s_prefix = 'Domain';
             $v_domains = $report->setDomain($i_domain_id);
         } else {
             $s_prefix = 'Account';
             $v_domains = $report->setDomain(-1);
         }
         if (is_array($arr_users) && count($arr_users)) {
             $report->setUserIDs($arr_users);
         }
         $result = $report->get();
     }
     if (isset($result['values']) && is_array($result['values'])) {
         natsort2d($result['values'], "cnt");
         $result['values'] = array_slice($result['values'], -$i_per_page, $i_per_page);
         natsort2d($result['values'], "value");
     }
     $max = intval($result['max']);
     $sum = intval($result['sum']);
     $arrTags = array();
     $s_values_label = $b_by_usage ? 'values' : 'labels';
     $s_value_label = $b_by_usage ? 'value' : 'tag';
     $s_value_cnt = 'cnt';
     $sz = sizeof($result[$s_values_label]);
     for ($i = 0; $i < $sz; $i++) {
         $label = $result[$s_values_label][$i];
         $tag = $label[$s_value_label];
         if (is_null($tag)) {
             continue;
         }
         //$tag = '[nontagged]';
         $cnt = intval($label[$s_value_cnt]);
         $f_weight = round($cnt * 100 / $sum, 1);
         $font_size = round(($max_font_size - $min_font_size) / 100 * $f_weight + $min_font_size);
         $arrTags[$tag] = array('weight' => $f_weight, 'font' => $font_size);
     }
     //
     $summ_weight = 0;
     if (count($arrTags)) {
         $arrTagsTplteds = array();
         foreach ($arrTags as $sTag => $arrTagStat) {
             $summ_weight += $arrTagStat['weight'];
             $params = array('tag' => $sTag, 'tag_urlencoded' => rawurlencode($sTag), 'attribute:weight' => $arrTagStat['weight'], 'attribute:font' => $arrTagStat['font'], 'attribute:context' => $s_prefix);
             $arrTagsTplteds[] = def_module::parseTemplate($tpl_tag, $params);
         }
         if (isset($arrTagsTplteds[0]) && is_array($arrTagsTplteds[0])) {
             // udata
             $arrForTags = array('subnodes:items' => $arrTagsTplteds);
         } else {
             // not udata
             $arrForTags = array('items' => implode($tpl_tag_sep, $arrTagsTplteds));
         }
         //
         $arrForTags['attribute:summ_weight'] = ceil($summ_weight);
         $arrForTags['attribute:context'] = $s_prefix;
         // RETURN
         return def_module::parseTemplate($tpl_tags, $arrForTags);
     } else {
         $arrForTags = array();
         // RETURN
         return def_module::parseTemplate($tpl_tags_empty, $arrForTags);
     }
 }
コード例 #4
0
function _get_contents_from_image_dir($image_path, $image_clicked, $KG_Path, $KG_Thumb, $id)
{
    global $database_table;
    $query = sprintf("SELECT image_name,thumb_width,thumb_height,image_size,image_date,image_type,thumb_name,image_width,image_height\n\t\t\tFROM {$database_table}\n\t\t\tWHERE image_dir\n\t\t\tLIKE '%s' \t", mysql_real_escape_string("{$image_path}"));
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $files[] = array("image_name" => "" . $row['image_name'] . "", "thumb_width" => "" . $row['thumb_width'] . "", "thumb_height" => "" . $row['thumb_height'] . "", "image_size" => "" . $row['image_size'] . "", "image_date" => "" . $row['image_date'] . "", "image_type" => "" . $row['image_type'] . "", "thumb_name" => "" . $row['thumb_name'] . "", "image_width" => "" . $row['image_width'] . "", "image_height" => "" . $row['image_height'] . "");
    }
    //asort($files);
    natsort2d($files);
    $z = 3;
    $x = 0;
    $y = $z;
    $num = mysql_num_rows($result);
    echo "<a name='image'/>";
    echo "<center>";
    echo "<table>";
    foreach ($files as $value) {
        $image = $value['image_name'];
        $width = $value['thumb_width'];
        $height = $value['thumb_height'];
        $thumb = $value['thumb_name'];
        $image_height = $value['image_height'];
        $image_width = $value['image_width'];
        $image_date = $value['image_date'];
        $image_size = $value['image_size'];
        if ($x == $y - $z) {
            echo "<tr>";
        }
        echo "<td>";
        echo "<a href='{$KG_Path}/{$image_path}/{$image}' class='lightview' rel='gallery[kindgirls]' title='{$image} :: Resolution:" . $image_width . 'x' . $image_height . " | Size: " . round($image_size, 2) . "KB | Date: {$image_date} ' ><img src='{$KG_Thumb}/{$thumb}' width='360'  align=center  /></a>";
        echo "</td>";
        $x = $x + 1;
        if ($x == $y) {
            echo "</tr>";
            $y = $x + $z;
        }
    }
    $fillin = $y - $num;
    while ($fillin != 0) {
        echo "<td>";
        echo "</td>";
        $fillin = $fillin - 1;
    }
    echo "</table> ";
    echo "</center>";
}