Changeset 13 for branches/download
- Timestamp:
- 02/08/09 17:52:03 (3 years ago)
- Location:
- branches/download
- Files:
-
- 6 modified
-
admin/download.php (modified) (8 diffs)
-
download.php (modified) (4 diffs)
-
install.php (modified) (3 diffs)
-
lang/English/admin_download.php (modified) (2 diffs)
-
lang/English/download.php (modified) (1 diff)
-
submit_download.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/download/admin/download.php
r12 r13 179 179 // Fetch page info 180 180 $query = array( 181 'SELECT' => 'd.name, d.cat, d. file, d.description, d.version, d.approved',181 'SELECT' => 'd.name, d.cat, d.description, d.author, d.version, d.approved', 182 182 'FROM' => 'downloads AS d', 183 183 'WHERE' => 'd.id='.$download_id … … 203 203 $file = isset($_POST['file']) ? basename($_POST['file']) : null; 204 204 $version = forum_trim($_POST['version']); 205 $author = forum_trim($_POST['author']); 205 206 $approved = isset($_POST['approved']) ? 1 : 0; 206 207 … … 208 209 message($lang_admin_download['Must enter download message']); 209 210 210 if (isset($_FILES['file_upload']) && is_uploaded_file($_FILES['file_upload']['tmp_name']))211 /* if (isset($_FILES['file_upload']) && is_uploaded_file($_FILES['file_upload']['tmp_name'])) 211 212 { 212 213 $file_upload = $_FILES['file_upload']['name']; 213 $file_ext = substr($file_upload, strrpos($file_upload, '.') );214 $file_ext = substr($file_upload, strrpos($file_upload, '.')+1); 214 215 215 216 if ($file_ext != 'zip') … … 231 232 232 233 move_uploaded_file($_FILES['file_upload']['tmp_name'], DOWNLOAD.'files/'.$file); 233 } 234 }*/ 234 235 235 236 $query = array( 236 237 'UPDATE' => 'downloads', 237 'SET' => 'name=\''.$forum_db->escape($name).'\', description=\''.$forum_db->escape($description).'\', cat='.$cat.', file=\''.$forum_db->escape($file).'\', version=\''.$forum_db->escape($version).'\', a pproved='.$approved,238 'SET' => 'name=\''.$forum_db->escape($name).'\', description=\''.$forum_db->escape($description).'\', cat='.$cat.', file=\''.$forum_db->escape($file).'\', version=\''.$forum_db->escape($version).'\', author=\''.$forum_db->escape($author).'\', approved='.$approved, 238 239 'WHERE' => 'id='.$download_id 239 240 ); … … 242 243 $forum_db->query_build($query) or error(__FILE__, __LINE__); 243 244 245 move_uploaded_file($_FILES['file_upload']['tmp_name'], DOWNLOAD.'files/'.$forum_db->insert_id().'.zip'); 246 244 247 ($hook = get_hook('afo_save_forum_pre_redirect')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 245 248 … … 319 322 </div> 320 323 </div> 321 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?>324 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null;/* ?> 322 325 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 323 326 <div class="sf-box select"> … … 340 343 </div> 341 344 </div> 342 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?>345 <?php*/ ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 343 346 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 344 347 <div class="sf-box text"> … … 347 350 </div> 348 351 </div> 352 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 353 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 354 <div class="sf-box text"> 355 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_download['Download author'] ?></span></label><br /> 356 <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="author" size="20" maxlength="80" value="<?php echo forum_htmlencode($cur_download['author']) ?>" /></span> 357 </div> 358 </div> 349 359 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 350 360 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> -
branches/download/download.php
r12 r13 21 21 // Fetch list of downloads 22 22 $query = array( 23 'SELECT' => 'd.name, d. file, d.version',23 'SELECT' => 'd.name, d.version', 24 24 'FROM' => 'downloads AS d', 25 25 'WHERE' => 'd.id=\''.$id.'\'', … … 38 38 $cur_file = $forum_db->fetch_assoc($result); 39 39 40 $file = DOWNLOAD.'files/'.$ cur_file['file'];41 42 if (!file_exists($file) || trim($cur_file['file']) == '')40 $file = DOWNLOAD.'files/'.$id.'.zip'; 41 42 if (!file_exists($file)) 43 43 message($lang_download['File not found']); 44 44 … … 126 126 // Fetch list of downloads 127 127 $query = array( 128 'SELECT' => 'd.id, d.name, d.description, d.version, d.downloads ',128 'SELECT' => 'd.id, d.name, d.description, d.version, d.downloads, d.author, d.user_id, d.added, u.username', 129 129 'FROM' => 'downloads AS d', 130 'JOINS' => array( 131 array( 132 'LEFT JOIN' => 'users AS u', 133 'ON' => 'd.user_id=u.id' 134 ), 135 ), 130 136 'WHERE' => 'd.cat='.$cat.' AND d.approved=1', 131 137 'LIMIT' => $forum_page['start_from'].', '.$forum_page['disp_downloads'], … … 178 184 { 179 185 $version_string = (trim($cur_download['version']) == '') ? '' : ' v'.forum_htmlencode($cur_download['version']); 186 $download_url = forum_link($forum_url['download_id'], array($cat, sef_friendly($cur_cat['name']), $cur_download['id'], sef_friendly($cur_download['name']))); 187 188 $forum_page['info'] = array(); 189 190 $forum_page['info'][] = '<a href="'.$download_url.'">'.$lang_download['Download'].'</a>'; 191 192 $forum_page['info'][] = sprintf($lang_download['Download count'], $cur_download['downloads']); 193 194 if ($cur_download['user_id'] > 0) 195 $forum_page['info'][] = $lang_download['Added by'].' <a href="'.forum_link($forum_url['user'], array($cur_download['user_id'])).'">'.forum_htmlencode($cur_download['username']).'</a>'; 196 197 if ($cur_download['author']) 198 $forum_page['info'][] = $lang_download['Author'].' '.forum_htmlencode($cur_download['author']); 199 200 if ($cur_download['added']) 201 $forum_page['info'][] = $lang_download['Added time'].' '.format_time($cur_download['added']); 202 180 203 ?> 181 204 <div class="ct-box data-box download"> 182 <h2 class="hn"><strong>< ?php echo forum_htmlencode($cur_download['name']) ?></strong><?php echo $version_string ?></h2>205 <h2 class="hn"><strong><a href="<?php echo $download_url ?>"><?php echo forum_htmlencode($cur_download['name']) ?></a></strong><?php echo $version_string ?></h2> 183 206 <?php if ($cur_download['description']) : ?> <p><?php echo forum_htmlencode($cur_download['description']) ?></p><?php endif; ?> 184 <p>< a href="<?php echo forum_link($forum_url['download_id'], array($cat, sef_friendly($cur_cat['name']), $cur_download['id'], sef_friendly($cur_download['name']))) ?>"><?php echo $lang_download['Download'] ?></a> (<?php printf($lang_download['Download count'], $cur_download['downloads']) ?>)</p>207 <p><?php echo implode(' | ', $forum_page['info']) ?></p> 185 208 </div> 186 209 <?php -
branches/download/install.php
r11 r13 78 78 'default' => '1.0' 79 79 ), 80 'file' => array( 80 'author' => array( 81 'datatype' => 'VARCHAR(255)', 82 'allow_null' => true, 83 ), 84 /* 'file' => array( 81 85 'datatype' => 'VARCHAR(255)', 82 86 'allow_null' => true 83 ), 87 ),*/ 84 88 'downloads' => array( 85 89 'datatype' => 'INT(10) UNSIGNED', … … 92 96 'default' => 0 93 97 ), 98 'user_id' => array( 99 'datatype' => 'INT(10) UNSIGNED', 100 'allow_null' => true, 101 ), 102 'added' => array( 103 'datatype' => 'INT(10) UNSIGNED', 104 'allow_null' => true, 105 ), 94 106 ), 95 107 'PRIMARY KEY' => array('id') … … 99 111 $forum_db->query('INSERT INTO '.$forum_db->prefix.'downloads (name, description, approved) VALUES (\'Geshi highlight\', \'test\', 1)') or error(__FILE__, __LINE__); 100 112 101 for ($i = 1; $i < 20; $i++)102 $forum_db->query('INSERT INTO '.$forum_db->prefix.'downloads (name, description, approved) VALUES (\'Extension '.$i.'\', \'test\', 1)') or error(__FILE__, __LINE__); 113 /* for ($i = 1; $i < 20; $i++) 114 $forum_db->query('INSERT INTO '.$forum_db->prefix.'downloads (name, description, approved) VALUES (\'Extension '.$i.'\', \'test\', 1)') or error(__FILE__, __LINE__);*/ 103 115 104 116 } -
branches/download/lang/English/admin_download.php
r12 r13 40 40 'Download version' => 'Download version:', 41 41 'Download version help' => 'You can leave this field empty', 42 'Download author' => 'Author:', 42 43 43 44 'Downloads for approve' => 'Downloads for approve', … … 51 52 'Submit download info' => 'Your download must be accepted by administrator.', 52 53 'Upload file' => 'Upload file:', 54 'Download submited redirect' => 'Download submited. Redirecting�', 53 55 54 56 'Invalid extension' => 'Invalid extension', -
branches/download/lang/English/download.php
r12 r13 15 15 'Download not found' => 'Download not found', 16 16 'File not found' => 'File not found', 17 18 'Added by' => 'Added by:', 19 'Author' => 'Author:', 20 'Added time' => 'Added:', 17 21 ); -
branches/download/submit_download.php
r12 r13 33 33 $cat = intval($_POST['cat']); 34 34 $version = forum_trim($_POST['version']); 35 $author = forum_trim($_POST['author']); 35 36 36 37 if ($name == '') … … 40 41 { 41 42 $file_upload = $_FILES['file_upload']['name']; 42 $file_ext = substr($file_upload, strrpos($file_upload, '.') );43 $file_ext = substr($file_upload, strrpos($file_upload, '.')+1); 43 44 44 45 if ($file_ext != 'zip') 45 46 message($lang_admin_download['Invalid extension']); 46 47 47 if (file_exists(DOWNLOAD.'files/'.$file_upload))48 /* if (file_exists(DOWNLOAD.'files/'.$file_upload)) 48 49 { 49 50 // Get new name for file … … 56 57 } 57 58 else 58 $file = $_FILES['file_upload']['name']; 59 60 move_uploaded_file($_FILES['file_upload']['tmp_name'], DOWNLOAD.'files/'.$file); 59 $file = $_FILES['file_upload']['name'];*/ 61 60 } 62 61 63 62 $query = array( 64 'INSERT' => 'name, description, cat, file, version',63 'INSERT' => 'name, description, cat, author, version, user_id, added', 65 64 'INTO' => 'downloads', 66 'VALUES' => '\''.$forum_db->escape($name).'\', \''.$forum_db->escape($description).'\', '.$cat.', \''.$forum_db->escape($ file).'\', \''.$forum_db->escape($version).'\'',65 'VALUES' => '\''.$forum_db->escape($name).'\', \''.$forum_db->escape($description).'\', '.$cat.', \''.$forum_db->escape($author).'\', \''.$forum_db->escape($version).'\', \''.$forum_db->escape($forum_user['id']).'\', '.time(), 67 66 ); 68 67 … … 76 75 $forum_db->query_build($query) or error(__FILE__, __LINE__); 77 76 77 move_uploaded_file($_FILES['file_upload']['tmp_name'], DOWNLOAD.'files/'.$forum_db->insert_id().'.zip'); 78 78 79 ($hook = get_hook('afo_save_forum_pre_redirect')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; 79 80 80 redirect(forum_link($forum_url['download']), $lang_admin_download['Download submited '].' '.$lang_common['Redirect']);81 redirect(forum_link($forum_url['download']), $lang_admin_download['Download submited redirect']); 81 82 } 82 83 … … 160 161 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 161 162 <div class="sf-box text"> 163 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_download['Download author'] ?></span></label><br /> 164 <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="author" size="20" maxlength="80" value="<?php echo forum_htmlencode($forum_user['username']) ?>" /></span> 165 </div> 166 </div> 167 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 168 169 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 170 <div class="sf-box text"> 162 171 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_download['Download version'] ?></span><small><?php echo $lang_admin_download['Download version help'] ?></small></label><br /> 163 172 <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="version" size="20" maxlength="80" /></span> 164 173 </div> 165 </div> 174 </div> 166 175 <?php ($hook = get_hook('afo_edit_forum_pre_forum_name')) ? (defined('FORUM_USE_INCLUDE') ? include $hook : eval($hook)) : null; ?> 167 176 <div class="txt-set set<?php echo ++$forum_page['item_count'] ?>">