Exemple #1
0
            $fields['cid'] = intval($in['cat']);
            $fields['desc_short'] = Fix_Quotes($in['desc_short'], true);
            $fields['desc_long'] = Fix_Quotes($in['desc_long'], true);
            $fields['name'] = Fix_Quotes($in['name'], true);
            $fields['email'] = Fix_Quotes($in['email'], true);
            $fields['active'] = can_admin($module_name) ? 1 : 2;
            $fields['access'] = can_admin($module_name) ? intval($in['access']) : 0;
            $fields['submitter'] = is_user() ? $userinfo['user_id'] : 'admin';
            $db->sql_query("INSERT INTO " . $dl_prefix . "_downloads \n\t\t\t\t(lid, cid, active, access, title, screen, desc_short, desc_long, date, name, email, submitter" . $field_list . ") \n\t\t\t\tVALUES \n\t\t\t\t(DEFAULT, '{$fields['cid']}', {$fields['active']}, '{$fields['access']}', '{$fields['title']}', '{$fields['screen']}', '{$fields['desc_short']}', '{$fields['desc_long']}', '" . time() . "', '{$fields['name']}', '{$fields['email']}', '{$fields['submitter']}'" . $value_list . ")");
            $next_id = $db->sql_nextid('lid');
            $db->sql_query("UPDATE " . $dl_prefix . "_mirrors \n\t\t\t\tSET did={$next_id} \n\t\t\t\tWHERE did={$mng_id}");
            $db->sql_query("UPDATE " . $dl_prefix . "_screenshots \n\t\t\t\tSET did={$next_id} \n\t\t\t\tWHERE did={$mng_id}");
            if (can_admin($module_name)) {
                $time = time();
                $time_year = generate_date($time, 'Y');
                $time_month = generate_date($time, 'm');
                $db->sql_query("INSERT INTO " . $dl_prefix . "_stats \n\t\t\t\t(id, year, month, hits, views) \n\t\t\t\tVALUES \n\t\t\t\t('{$next_id}', '{$time_year}', '{$time_month}', 0, 0)");
            }
            if ($fields['version']) {
                $db->sql_query("INSERT INTO " . $dl_prefix . "_history \n\t\t\t\t(id, vers, author, date, comment) \n\t\t\t\tVALUES \n\t\t\t\t({$next_id}, '{$fields['version']}', '{$fields['submitter']}', " . time() . ", 'Initial Version')");
            }
            if (!can_admin($module_name)) {
                $d_queue = $db->sql_count($dl_prefix . '_downloads', "lid!='{$next_id}' AND active=2");
                cpg_error('Your download has been queued for review by an administrator<br /><br />At this time, we have <strong>' . $d_queue . '</strong> other downloads awaiting approval', _TB_INFO, URL::index('&file=manage&s=1', true, true));
            }
            DL_Cat::count_dl();
            URL::redirect(URL::index('&amp;file=details&amp;id=' . $next_id));
        }
    }
}
$cats = array();
Exemple #2
0
 function add_result($row)
 {
     global $db, $dl_prefix, $cpgtpl, $module_name;
     $this->result[$this->result_count++] = $row;
     $rating_info = get_rating($row['score'], $row['votes']);
     if ($row['date'] >= $row['updated']) {
         $row['date'] = _DLP_PUBLISHED . ': ' . generate_date($row['date']) . mark_date($row['date'], 3, 1, '', 2);
     } else {
         $row['date'] = _DLP_UPDATED . ': ' . generate_date($row['updated']) . mark_date($row['updated'], 3, 2, '', 2);
     }
     if (can_download($row['active'], $row['access'])) {
         $img = dl_image($row['access'] > 0 ? 'download_small_yes.png' : 'download_small.png');
         $img_title = _DLP_DLNOW;
     } else {
         $img = dl_image('download_small_no.png');
         $img_title = _DLP_DLFORBIDDEN;
     }
     if ($row['img_url']) {
         if (ereg('://', $row['img_url'])) {
             $row['img_url'] .= '" width="100';
         } else {
             $row['img_url'] = dl_thumbimage($row['img_url']) . '" width="100';
         }
     }
     $cpgtpl->assign_block_vars('dl_item', array('TITLE' => $row['title'], 'U_INFO' => URL::index('&amp;file=details&amp;id=' . $row['lid']), 'U_GET' => URL::index('&amp;get=' . $row['lid']), 'U_IMG' => $row['screen'] ? URL::index('&amp;screen=' . $row['screen']) : '', 'U_HOME' => $row['homepage'], 'U_WRITE' => URL::index('&amp;review=' . $row['lid']), 'U_REVIEWS' => URL::index('&amp;file=details&amp;id=' . $row['lid'] . '#reviews'), 'NO_REVIEWS' => $row['votes'] == 0 && is_user(), 'REVIEWS' => sprintf($row['votes'] == 1 ? '%s review' : '%s reviews', $row['votes']), 'VERSION' => !empty($row['version']) ? _VERSION . ' ' . $row['version'] : '', 'NOT_ACTIVE' => $row['active'] == 0 && can_admin($module_name) ? _DLP_INACTIVE : '', 'E_PICK' => $row['pick'] ? _DLP_EDPICK : '', 'SECURE' => isset($row['cpgcs']) && $row['cpgcs'] ? 'Certified Secure' : '', 'SUBMITTER' => is_numeric($row['submitter']) ? '<a href="' . URL::index('&amp;file=search&amp;sa=' . $row['submitter']) . '">' . $row['username'] . '</a>' : $row['submitter'], 'DL_IMG' => $img, 'DL_IMG_TITLE' => $img_title, 'RATING_IMG' => $rating_info['image'], 'POP_IMG' => popularity($row['lid']), 'DATE' => $row['date'], 'DESC' => nl2br($row['desc_short']), 'U_SCREEN' => URL::index('&amp;screen=' . $row['screen']), 'IMG_SCREEN' => $row['img_url'], 'IMG_MISSING' => dl_image('missing.png'), 'L_VIEWALLSCREENS' => _DLP_VIEWALLSCREENS, 'L_NOSCREENS' => _DLP_NOSCREENSHOTS, 'L_SUBMITTEDBY' => _DLP_SUBMITTEDBY));
 }
Exemple #3
0
    } else {
        $cpgtpl->assign_var('DL_REVIEWS', false);
    }
    $db->sql_freeresult($result);
    if (can_admin($module_name) || $row['submitter'] == $userinfo['user_id']) {
        // pagination
        $cur_page2 = isset($_GET['p_page']) && $_GET['p_page'] > 0 ? intval($_GET['p_page']) : 1;
        $limit2 = ($cur_page2 - 1) * $perpage;
        $result = $db->sql_query("SELECT r.id, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username, COUNT(r.score) AS votes FROM " . $dl_prefix . "_ratings r\n\tLEFT JOIN " . $user_prefix . "_users u ON (u.user_id = r.uid)\n\tWHERE r.lid='{$global_id}' AND r.comment!='' AND active=0 \n\tGROUP BY r.id DESC, r.uid, r.ip, r.title, r.comment, r.score, r.timestamp, u.username \n\tLIMIT {$perpage} OFFSET {$limit2}");
        list($pending) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $dl_prefix . "_ratings \n\tWHERE lid='{$global_id}' AND active=0");
        if ($db->sql_numrows($result)) {
            $cpgtpl->assign_vars(array('DL_P_REVIEW_PAGES' => ceil($pending / $perpage) > 1 ? gen_pagination($pending, $perpage, $cur_page2, '&amp;file=details&amp;id=' . $global_id, 'p_reviews', 'p_page') : false, 'DL_P_REVIEWS' => $pending));
            $i = 0;
            while (list($review_id, $review_uid, $review_ip, $review_title, $review_comment, $review_score, $review_timestamp, $review_uname, $review_votes) = $db->sql_fetchrow($result)) {
                $rating_info = get_rating($review_score, $review_votes);
                $cpgtpl->assign_block_vars('dl_p_review', array('ID' => $review_id, 'U_ID' => htmlprepare(URL::uri()) . '#r' . $review_id, 'RATING' => _DLP_REVIEW . ' #' . $review_id . ': ' . $rating_info['desc'], 'U_MEMBER' => URL::index('Your_Account&amp;profile=' . $review_uid), 'MEMBERNAME' => $review_uname, 'DATE' => generate_date($review_timestamp), 'U_DEL' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;del_review=' . $review_id) . '">[' . strtolower(_DELETE) . ']</a>' : false, 'U_APPR' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;approve_review=' . $review_id) . '">[' . strtolower(_DLP_APPROVE) . ']</a>' : false, 'TITLE' => $review_title, 'COMMENT' => decode_bb_all($review_comment), 'IP' => decode_ip($review_ip), 'IMG_RATE' => dl_image('stars/' . $rating_info['rating'] . '.png'), 'SPACER' => $i > 0));
                $i++;
            }
        } else {
            $cpgtpl->assign_var('DL_P_REVIEWS', false);
        }
        $db->sql_freeresult($result);
    } else {
        $cpgtpl->assign_var('DL_P_REVIEWS', false);
    }
}
if ($row['pick']) {
    $cpgtpl->assign_block_vars('dl_image', array('SRC' => dl_image('pick.png'), 'TITLE' => _DLP_EDPICK));
}
// custom fields: images
$result = $db->sql_query("SELECT field, img_path, img_alt FROM " . $dl_prefix . "_fields \n\tWHERE type=3 AND visible > 0");
Exemple #4
0
            }
            if (isset($ws['moistMinYearTime'][$i])) {
                echo generate_date($ws['moistMinYearTime'][$i], 'month');
            } else {
                echo generate_date('n/a');
            }
            if ($show_alltime) {
                if (isset($ws['moistMinAll'][$i])) {
                    echo generate_value($ws['moistMinAll'][$i], $uom);
                } else {
                    echo generate_value('n/a');
                }
                if (isset($ws['moistMinAllTime'][$i])) {
                    echo generate_date($ws['moistMinAllTime'][$i], 'date');
                } else {
                    echo generate_date('n/a');
                }
            }
            echo '</tr>' . PHP_EOL;
        } else {
            echo '<tr><td colspan="' . $colspan . '">&nbsp;</td></tr>' . PHP_EOL;
        }
    }
    // eo loop 4 sensors
}
// eo soil
?>
</tbody>
</table>
</div>
<?php 
Exemple #5
0
     $pagetitle .= ' ' . _BC_DELIM . ' Broken Download Reports';
     $sql = "SELECT b.id, b.uid, b.report, b.date, d.lid, d.title, m.id AS mirror_id, m.url AS mirror_url, u.username FROM " . $dl_prefix . "_broken b\n\t\t\tLEFT JOIN " . $dl_prefix . "_downloads d ON (d.lid = b.lid)\n\t\t\tLEFT JOIN " . $dl_prefix . "_mirrors m ON (m.id = b.mid)\n\t\t\tLEFT JOIN " . $user_prefix . "_users u ON (u.user_id = b.uid)\n\t\t\tWHERE d.submitter='{$userinfo['user_id']}' \n\t\t\tORDER BY b.id";
     $result = $db->sql_query($sql);
     $total_author = $db->sql_numrows($result);
     $cpgtpl->assign_vars(array('DL_MENU' => '<span class="gen"><strong>My Downloads</strong></span><br /><a href="' . URL::index() . '">Main Page</a> | <a href="' . URL::index('&amp;file=manage') . '">Current Downloads</a> | <a href="' . URL::index('&amp;file=manage&amp;s=1') . '">Pending Downloads</a> | <strong>Broken D/L Reports</strong>', 'DL_NO_ITEMS' => $total_author < 1 ? sprintf(_ERROR_NONE_TO_DISPLAY, 'reports') : false, 'TABLE_BGCOLOR' => $bgcolor2));
     if ($total_author) {
         $bgcolor = $bgcolor3;
         while ($row = $db->sql_fetchrow($result)) {
             $bgcolor = $bgcolor == $bgcolor2 ? $bgcolor3 : $bgcolor2;
             if (ereg('://', $row['mirror_url'])) {
                 $url = parse_url($row['mirror_url']);
                 $site = shrink_url($url['host']);
             } else {
                 $site = $MAIN_CFG['server']['domain'];
             }
             $cpgtpl->assign_block_vars('dl_item', array('BGCOLOR' => $bgcolor, 'DATE' => generate_date($row['date']), 'TITLE' => $row['title'], 'URL' => URL::index('&amp;file=details&amp;id=' . $row['id']), 'MIRROR' => $row['mirror_url'], 'MIRROR_SITE' => $site, 'REPORT' => $row['report'], 'U_USER' => URL::index('Your_Account&amp;profile=' . $row['uid']), 'USERNAME' => $row['username'], 'U_DISMISS' => URL::index('&amp;file=manage&amp;s=2&amp;dismiss=' . $row['id']), 'U_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $row['lid'])));
         }
     }
     $db->sql_freeresult($result);
     $cpgtpl->set_filenames(array('body' => 'downloads/my_broken.html'));
 } else {
     $pagetitle .= ' ' . _BC_DELIM . ' Current';
     $total_author = $db->sql_count($dl_prefix . '_downloads', "submitter='{$userinfo['user_id']}' AND active!=2");
     $cpgtpl->assign_vars(array('L_CATEGORY' => _CATEGORY, 'L_EDIT' => _EDIT, 'DL_MENU' => '<span class="gen"><strong>My Downloads</strong></span><br /><a href="' . URL::index() . '">Main Page</a> | <strong>Current Downloads</strong> | <a href="' . URL::index('&amp;file=manage&amp;s=1') . '">Pending Downloads</a> | <a href="' . URL::index('&amp;file=manage&amp;s=2') . '">Broken D/L Reports</a>', 'DL_NO_ITEMS' => $total_author < 1 ? sprintf(_ERROR_NONE_TO_DISPLAY, strtolower(_DOWNLOADS)) : false, 'DL_PAGINATION' => ceil($total_author / $perpage) > 1 ? gen_pagination($total_author, $perpage, $cur_page, '&amp;file=manage') : false));
     if ($total_author) {
         $rating = $db->sql_query("SELECT lid, SUM(score)/COUNT(lid) AS score FROM " . $dl_prefix . "_ratings \n\t\t\tGROUP BY lid");
         while ($rows = $db->sql_fetchrow($rating)) {
             $ratings[$rows[0]]['score'] = $rows[1];
         }
         $result = $db->sql_query("SELECT d.lid, d.cid, d.title, d.active, d.desc_short, SUM(s.hits) as hits, SUM(s.views) as views FROM " . $dl_prefix . "_downloads d\n\t\t\t\tLEFT JOIN " . $dl_prefix . "_stats s ON (s.id = d.lid)\n\t\t\t\tWHERE d.submitter='{$userinfo['user_id']}' AND d.active!=2 \n\t\t\t\tGROUP BY d.lid, d.cid, d.title, d.active, d.desc_short \n\t\t\t\tLIMIT {$perpage} OFFSET {$limit}");
         while ($row = $db->sql_fetchrow($result)) {
Exemple #6
0
list($total_yearly_hits, $total_yearly_views) = $db->sql_ufetchrow("SELECT SUM(hits), SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}'", SQL_NUM);
list($total_monthly_hits, $total_monthly_views) = $db->sql_ufetchrow("SELECT SUM(hits), SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}'", SQL_NUM);
$yh = $db->sql_query("SELECT year, SUM(hits) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' \n\tGROUP BY year \n\tORDER BY year");
$mh = $db->sql_query("SELECT month, SUM(hits) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}' \n\tGROUP BY month \n\tORDER BY month", SQL_NUM);
$yv = $db->sql_query("SELECT year, SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' \n\tGROUP BY year \n\tORDER BY year");
$mv = $db->sql_query("SELECT month, SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}' \n\tGROUP BY month \n\tORDER BY month", SQL_NUM);
$months = array(1 => _JANUARY, _FEBRUARY, _MARCH, _APRIL, _MAY, _JUNE, _JULY, _AUGUST, _SEPTEMBER, _OCTOBER, _NOVEMBER, _DECEMBER);
$colors = array(1 => '8D1B1B', '6740E1', '8D8D8D', 'CC8500', '5B781E');
$rand_colors = array_rand($colors);
//$modheader .= '<link rel="stylesheet" type="text/css" href="modules/'.$module_name.'/include/style.css" />';
$pagetitle .= $module_title . ' ' . _BC_DELIM . ' ' . _StatisticsLANG . ' ' . _BC_DELIM . ' ' . $dl_title;
require_once 'header.php';
OpenTable();
echo dl_detail_menu($global_id, $dl_title, $dl_pick, $dl_active, 5) . '<br /><br />
   <span class="genmed"><strong>' . _StatisticsLANG . '</strong></span><br />
   This download has received <strong>' . $tot_hits . '</strong> ' . strtolower(_HITS) . ' and <strong>' . $tot_views . '</strong> page views since it was published ' . generate_date($dl_date, 'F j, Y') . '.<br /><br />
   <span class="genmed"><strong>Yearly Hits</strong></span><br /><br />
    <table border="0" style="background:' . $bgcolor2 . ';" cellspacing="1" cellpadding="3">
     <tr>
       <td style="background:' . $bgcolor3 . ';">' . _YEAR . '</td>
       <td style="background:' . $bgcolor3 . ';" colspan="2">' . _HITS . '</td>
     </tr>';
while (list($h_year, $h_year_hits) = $db->sql_fetchrow($yh)) {
    $width = $h_year_hits == 0 ? 100 * $h_year_hits : round(100 * $h_year_hits / $total_yearly_hits, 0);
    echo '
     <tr style="background:' . $bgcolor1 . ';">
       <td>' . ($h_year != $time_year ? '<a href="' . URL::index('&amp;file=statistics&amp;id=' . $global_id . '&amp;h_year=' . $h_year) . '">' . $h_year . '</a>' : $h_year) . '</td>
       <td style="white-space:nowrap;"><img src="themes/' . $CPG_SESS['theme'] . '/images/leftbar.gif" alt="" width="' . $l_size[0] . '" height="' . $l_size[1] . '" /><img src="themes/' . $CPG_SESS['theme'] . '/images/mainbar.gif" alt="" width="' . $width * 2 . '" height="' . $m_size[1] . '" /><img src="themes/' . $CPG_SESS['theme'] . '/images/rightbar.gif" alt="" width="' . $r_size[0] . '" height="' . $r_size[1] . '" /></td>
       <td>' . $h_year_hits . '</td>
     </tr>';
}