Changeset 74
- Timestamp:
- 02/28/2010 02:31:16 AM (3 years ago)
- Location:
- trunk/Upload
- Files:
-
- 26 edited
- 1 moved
-
admin/manage/ad_articles.php (modified) (11 diffs)
-
admin/manage/ad_news.php (modified) (7 diffs)
-
admin/manage/ad_tickets.php (modified) (2 diffs)
-
admin/manage/ad_users.php (modified) (1 diff)
-
includes/classes/class_askin.php (modified) (1 diff)
-
includes/classes/class_session.php (modified) (13 diffs)
-
includes/classes/class_skin.php (modified) (2 diffs)
-
includes/css/tiburon.css (modified) (1 diff)
-
includes/functions/func_articles.php (modified) (3 diffs)
-
includes/functions/func_rebuild.php (modified) (2 diffs)
-
includes/scripts/common.js (moved) (moved from trunk/Upload/includes/scripts/global.js)
-
includes/trellis.php (modified) (5 diffs)
-
install/index.php (modified) (1 diff)
-
language/en/lang_global.php (modified) (3 diffs)
-
language/en/lang_knowledgebase.php (modified) (1 diff)
-
skin/s1/acc_change_email.tpl (modified) (1 diff)
-
skin/s1/acc_change_pass.tpl (modified) (1 diff)
-
skin/s1/acc_modify.tpl (modified) (1 diff)
-
skin/s1/dashboard.tpl (modified) (7 diffs)
-
skin/s1/kb_article.tpl (modified) (2 diffs)
-
skin/s1/wrapper.tpl (modified) (1 diff)
-
skin/s2/wrapper.tpl (modified) (1 diff)
-
sources/account.php (modified) (3 diffs)
-
sources/dashboard.php (modified) (3 diffs)
-
sources/knowledgebase.php (modified) (25 diffs)
-
sources/tickets.php (modified) (2 diffs)
-
upgrade/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Upload/admin/manage/ad_articles.php
r73 r74 232 232 #============================= 233 233 234 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'description', 'content', 'rating ', 'votes', 'views', 'comments', 'html', 'date', 'modified', 'allow_comments', 'allow_rating' ), $this->trellis->input['id'] ) ) $this->trellis->skin->error('no_article');234 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'description', 'content', 'rating_average', 'votes', 'views', 'comments', 'html', 'date', 'modified', 'allow_comments', 'allow_rating' ), $this->trellis->input['id'] ) ) $this->trellis->skin->error('no_article'); 235 235 236 236 #============================= … … 275 275 ( $a['modified'] ) ? $a['modified_human'] = $this->trellis->td_timestamp( array( 'time' => $a['modified'], 'format' => 'long' ) ) : $a['modified_human'] = '--'; 276 276 277 $a['rating_visual'] = $this->trellis->skin->rating_visual( $a['rating '] );277 $a['rating_visual'] = $this->trellis->skin->rating_visual( $a['rating_average'] ); 278 278 279 279 if ( ! $a['description'] ) $a['description'] = '<i>{lang.no_description}</i>'; … … 282 282 ( $a['allow_rating'] ) ? $a['rating_status'] = '({lang.enabled})' : $a['rating_status'] = '({lang.disabled})'; 283 283 284 $aoutput_params = array( 'urls' => 1 ); 285 286 ( $a['html'] ) ? $aoutput_params['html'] = 1 : $aoutput_params['nl2br'] = 1; 284 $aoutput_params = array( 'linkify' => 1 ); 285 286 if ( $a['html'] ) 287 { 288 $aoutput_params['html'] = 1; 289 } 290 else 291 { 292 $aoutput_params['paragraphs'] = 1; 293 $aoutput_params['nl2br'] = 1; 294 } 287 295 288 296 $a['content'] = $this->trellis->prepare_output( $a['content'], $aoutput_params ); … … 372 380 $c['date'] = $this->trellis->td_timestamp( array( 'time' => $c['date'], 'format' => 'long' ) ); 373 381 374 $coutput_params = array( 'urls' => 1 ); 375 376 ( $c['html'] ) ? $coutput_params['html'] = 1 : $coutput_params['nl2br'] = 1; 382 $coutput_params = array( 'linkify' => 1 ); 383 384 if ( $c['html'] ) 385 { 386 $coutput_params['html'] = 1; 387 } 388 else 389 { 390 $coutput_params['paragraphs'] = 1; 391 $coutput_params['nl2br'] = 1; 392 } 377 393 378 394 $c['message'] = $this->trellis->prepare_output( $c['message'], $coutput_params ); 379 395 380 /*if ( $c['signature'] ) $c['message'] .= '<br /><br />'. $this->trellis->prepare_output( $c['usignature'], array( 'html' => $c['sig_html'] ) );*/396 if ( $c['signature'] ) $c['message'] .= '<br /><br />'. $this->trellis->prepare_output( $c['usignature'], array( 'html' => $c['sig_html'] ) ); # TODO: sigs on comments? 381 397 382 398 $this->output .= "<div id='cc{$c['id']}'> … … 457 473 plugins : 'inlinepopups,safari,spellchecker', 458 474 dialog_type : 'modal', 459 forced_root_block : false,460 force_br_newlines : true,461 force_p_newlines : false,462 475 theme_advanced_toolbar_location : 'top', 463 476 theme_advanced_toolbar_align : 'left', … … 747 760 748 761 if ( ! $this->trellis->input['title'] ) $this->add_article('no_title'); 749 if ( ! $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] )) $this->add_article('no_content');762 if ( ! $this->trellis->input['content'] ) $this->add_article('no_content'); 750 763 751 764 #============================= … … 757 770 'title' => $this->trellis->input['title'], 758 771 'description' => $this->trellis->input['description'], 759 'content' => $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] ),772 'content' => $this->trellis->input['content'], 760 773 'allow_comments' => $this->trellis->input['allow_comments'], 761 774 'allow_rating' => $this->trellis->input['allow_rating'], … … 790 803 791 804 if ( ! $this->trellis->input['title'] ) $this->edit_article('no_title'); 792 if ( ! $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] )) $this->edit_article('no_content');805 if ( ! $this->trellis->input['content'] ) $this->edit_article('no_content'); 793 806 794 807 #============================= … … 800 813 'title' => $this->trellis->input['title'], 801 814 'description' => $this->trellis->input['description'], 802 'content' => $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] ),815 'content' => $this->trellis->input['content'], 803 816 'allow_comments' => $this->trellis->input['allow_comments'], 804 817 'allow_rating' => $this->trellis->input['allow_rating'], … … 918 931 # Security Checks 919 932 #============================= 920 921 if ( $this->trellis->input['html'] )922 {923 $this->trellis->input['message'] = $this->trellis->remove_extra_lbs( $this->trellis->input['message'] );924 }925 933 926 934 if ( ! $this->trellis->input['message'] ) $this->view_article( array( 'comment_error' => 'no_message' ) ); … … 966 974 # Security Checks 967 975 #============================= 968 969 if ( $this->trellis->input['html'] )970 {971 $this->trellis->input['message'] = $this->trellis->remove_extra_lbs( $this->trellis->input['message'] );972 }973 976 974 977 if ( ! $this->trellis->input['message'] ) $this->trellis->skin->ajax_output( '0' ); -
trunk/Upload/admin/manage/ad_news.php
r73 r74 124 124 foreach( $news as $nid => $n ) 125 125 { 126 if ( $n['excerpt'] ) 127 { 128 $n['content'] = $this->trellis->prepare_output( $n['excerpt'] ); 129 } 130 else 131 { 132 if ( $this->trellis->cache->data['settings']['news']['rte'] ) 133 { 134 $n['content'] = $this->trellis->shorten_str( $this->trellis->remove_html( $this->trellis->convert_html( $n['content'] ) ), 80, 1 ); 135 } 136 else 137 { 138 $n['content'] = $this->trellis->shorten_str( $n['excerpt'], 80, 1 ); 139 } 140 } 126 if ( ! $n['excerpt'] ) $n['excerpt'] = '<i>{lang.no_excerpt}</i>'; 141 127 142 128 $news_rows .= "<tr> 143 129 <td class='bluecellthin-light'><strong>{$n['id']}</strong></td> 144 130 <td class='bluecellthin-dark'><a href='<! HD_URL !>/admin.php?section=manage&page=news&act=view&id={$n['id']}'>{$n['title']}</a></td> 145 <td class='bluecellthin-light' style='font-weight: normal'><a href='<! HD_URL !>/admin.php?section=manage&page=news&act=view&id={$n['id']}'>{$n[' content']}</a></td>131 <td class='bluecellthin-light' style='font-weight: normal'><a href='<! HD_URL !>/admin.php?section=manage&page=news&act=view&id={$n['id']}'>{$n['excerpt']}</a></td> 146 132 <td class='bluecellthin-light' align='center'><a href='<! HD_URL !>/admin.php?section=manage&page=news&act=edit&id={$n['id']}'><img src='<! IMG_DIR !>/button_edit.gif' alt='{lang.edit}' /></a></td> 147 133 <td class='bluecellthin-light' align='center'><a href='<! HD_URL !>/admin.php?section=manage&page=news&act=dodel&id={$n['id']}' onclick='return confirmDelete({$n['id']})'><img src='<! IMG_DIR !>/button_delete.gif' alt='{lang.delete}' /></a></td> … … 425 411 plugins : 'inlinepopups,safari,spellchecker', 426 412 dialog_type : 'modal', 427 forced_root_block : false,428 force_br_newlines : true,429 force_p_newlines : false,430 413 theme_advanced_toolbar_location : 'top', 431 414 theme_advanced_toolbar_align : 'left', … … 700 683 701 684 if ( ! $this->trellis->input['title'] ) $this->add_news('no_title'); 702 if ( ! $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] )) $this->add_news('no_content');685 if ( ! $this->trellis->input['content'] ) $this->add_news('no_content'); 703 686 704 687 #============================= 705 688 # Add News 706 689 #============================= 690 691 ( $this->trellis->input['html'] && $this->trellis->cache->data['settings']['news']['rte'] ) ? $html = 1 : $html = 0; 707 692 708 693 $db_array = array( … … 713 698 'email' => $this->trellis->input['email_users'], 714 699 'allow_comments' => $this->trellis->input['allow_comments'], 715 'html' => $ this->trellis->input['html'],700 'html' => $html, 716 701 'date' => time(), 717 702 'ipadd' => $this->trellis->input['ip_address'], … … 726 711 #============================= 727 712 728 // TO BE COMPLETED713 # TODO: to be completed 729 714 730 715 #============================= … … 758 743 759 744 if ( ! $this->trellis->input['title'] ) $this->edit_news('no_title'); 760 if ( ! $this->trellis-> remove_extra_lbs( $this->trellis->input['content'] )) $this->edit_news('no_content');745 if ( ! $this->trellis->input['content'] ) $this->edit_news('no_content'); 761 746 762 747 #============================= 763 748 # Update News 764 749 #============================= 750 751 ( $this->trellis->input['html'] && $this->trellis->cache->data['settings']['news']['rte'] ) ? $html = 1 : $html = 0; 765 752 766 753 $db_array = array( … … 770 757 'content' => $this->trellis->input['content'], 771 758 'allow_comments' => $this->trellis->input['allow_comments'], 772 'html' => $ this->trellis->input['html'],759 'html' => $html, 773 760 ); 774 761 -
trunk/Upload/admin/manage/ad_tickets.php
r73 r74 1143 1143 $toutput_params = array( 'linkify' => 1 ); 1144 1144 1145 ( $t['html'] ) ? $toutput_params['html'] = 1 : $toutput_params['nl2br'] = 1; 1145 if ( $t['html'] ) 1146 { 1147 $toutput_params['html'] = 1; 1148 } 1149 else 1150 { 1151 $toutput_params['paragraphs'] = 1; 1152 $toutput_params['nl2br'] = 1; 1153 } 1146 1154 1147 1155 $t['message'] = $this->trellis->prepare_output( $t['message'], $toutput_params ); … … 1363 1371 $routput_params = array( 'linkify' => 1 ); 1364 1372 1365 if ( $r['html'] ) 1366 { 1367 $routput_params['html'] = 1; 1368 } 1369 else 1370 { 1371 $routput_params['nl2br'] = 1; 1372 } 1373 if ( $r['html'] ) 1374 { 1375 $routput_params['html'] = 1; 1376 } 1377 else 1378 { 1379 $routput_params['paragraphs'] = 1; 1380 $routput_params['nl2br'] = 1; 1381 } 1373 1382 1374 1383 $r['message'] = $this->trellis->prepare_output( $r['message'], $routput_params ); -
trunk/Upload/admin/manage/ad_users.php
r73 r74 1080 1080 } 1081 1081 1082 # *if staff member has updated sub-groups, merge with any hidden groups that may have already been selected1082 # TODO: if staff member has updated sub-groups, merge with any hidden groups that may have already been selected 1083 1083 1084 1084 #============================= -
trunk/Upload/includes/classes/class_askin.php
r72 r74 1542 1542 <script src="includes/scripts/jqueryextras.js" type="text/javascript"></script> 1543 1543 <script src="includes/tinymce/tiny_mce.js" type="text/javascript"></script> 1544 <script src="includes/scripts/ global.js" type="text/javascript"></script>1544 <script src="includes/scripts/common.js" type="text/javascript"></script> 1545 1545 <% JAVASCRIPT %> 1546 1546 </head> -
trunk/Upload/includes/classes/class_session.php
r52 r74 22 22 class td_class_session { 23 23 24 var $user = array();24 var $user = array(); 25 25 26 26 #======================================= 27 27 # @ Load Session 28 # Loads the session. What else? :D 29 #======================================= 30 31 function load_session() 28 #======================================= 29 30 public function load_session() 32 31 { 33 $authorized = 0; // Initialize for Security 34 35 #============================= 36 # Kill Any Bad Sessions 37 #============================= 38 39 $this->kill_old_tokens(); 32 $authorized = 0; 40 33 41 34 #============================= … … 84 77 #============================= 85 78 79 $location = array(); 80 81 if ( $this->trellis->input['page'] ) $location['page'] = $this->trellis->input['page']; 82 if ( $this->trellis->input['act'] ) $location['act'] = $this->trellis->input['act']; 83 if ( $this->trellis->input['id'] ) $location['id'] = $this->trellis->input['id']; 84 86 85 $this->trellis->db->construct( array( 87 86 'update' => 'sessions', 88 'set' => array( 's_location' => $this->trellis->input['act'], 's_time'=> time() ),87 'set' => array( 's_location' => serialize( $location ), 's_time' => time() ), 89 88 'where' => array( 's_id', '=', $this->user['s_id'] ), 90 89 'limit' => array( 1 ), … … 249 248 #======================================= 250 249 # @ Do Login 251 # Attempt to login. 252 #======================================= 253 254 function do_login() 250 #======================================= 251 252 public function do_login() 255 253 { 256 254 #============================= … … 258 256 #============================= 259 257 260 $this->trellis->check_token('login'); 261 262 if ( ! $this->trellis->input['username'] || ! $this->trellis->input['password'] ) 263 { 264 $this->error('fill_form_completely', 1); 265 } 258 if ( ! $this->trellis->input['username'] || ! $this->trellis->input['password'] ) $this->error( 'fill_form_completely', 1 ); 266 259 267 260 #============================= … … 285 278 { 286 279 $this->error('login_no_user', 1); 280 281 # TD LOG: name not found 287 282 } 288 283 … … 299 294 #============================= 300 295 301 if ( ! $mem['val_email'] ) $this->error('login_must_val'); 302 303 if ( ! $mem['val_admin'] ) $this->error('login_must_val_admin'); 296 if ( ! $mem['val_email'] ) $this->error('login_must_val'); # TD LOG: no email val 297 298 if ( ! $mem['val_admin'] ) $this->error('login_must_val_admin'); # TD LOG: no admin val 304 299 305 300 #============================= … … 393 388 else 394 389 { 395 $this->error('login_no_pass', 1); 390 $this->error('login_no_pass', 1); # TD Log: incorrect pass 396 391 } 397 392 } … … 399 394 #======================================= 400 395 # @ Do Guest Login 401 # Attempt to login a guest. 402 #======================================= 403 404 function do_guest_login() 396 #======================================= 397 398 public function do_guest_login() 405 399 { 406 400 #============================= … … 408 402 #============================= 409 403 410 if ( $onthefly ) 404 if ( $onthefly ) # TODO: guest tickets 411 405 { 412 406 $this->trellis->input['email_address'] = $this->trellis->input['email']; 413 407 $this->trellis->input['ticket_key'] = $this->trellis->input['key']; 414 408 } 415 else416 {417 $this->trellis->check_token('glogin');418 }419 409 420 410 if ( ! $this->trellis->validate_email( $this->trellis->input['email_address'] ) ) 421 411 { 422 412 $this->error('no_valid_email'); 423 }424 425 if ( strlen( $this->trellis->input['ticket_key'] ) != 11 )426 {427 $this->error('no_valid_tkey');428 413 } 429 414 … … 442 427 if ( $this->trellis->db->get_num_rows() != 1 ) 443 428 { 444 $this->error('no_ticket_guest'); 429 $this->error('no_ticket_guest'); # TD LOG: guest ticket not found 445 430 } 446 431 … … 473 458 #======================================= 474 459 # @ Do Logout 475 # Attempt to logout. 476 #======================================= 477 478 function do_logout() 460 #======================================= 461 462 public function do_logout() 479 463 { 480 464 if ( ! $this->trellis->user['id'] ) $this->error('logout_already_guest'); … … 556 540 #======================================= 557 541 # @ Kill Old Sessions 558 # Kills sessions older than the session 559 # timeout (defined in ACP). 560 #======================================= 561 562 function kill_old_sessions() 542 #======================================= 543 544 private function kill_old_sessions() 563 545 { 564 546 $timeout = time() - ( $this->trellis->cache->data['settings']['security']['session_timeout'] * 60 ); … … 578 560 579 561 #======================================= 580 # @ Kill Old Tokens581 # Kills tokens older than 1 hour.582 #=======================================583 584 function kill_old_tokens()585 {586 if ( $this->trellis->cache->data['settings']['security']['form_tokens'] )587 {588 $timeout = time() - ( 60 * 60 );589 590 $this->trellis->db->construct( array(591 'delete' => 'tokens',592 'where' => array( 'date', '<=', $timeout ),593 ) );594 595 $this->trellis->db->next_shutdown();596 $this->trellis->db->execute();597 598 $num_killed = $this->trellis->db->get_num_rows();599 600 return $num_killed;601 }602 }603 604 #=======================================605 562 # @ Error 606 563 #======================================= 607 564 608 function error($msg, $login=0)565 private function error($msg, $login=0) 609 566 { 610 567 $this->trellis->load_skin(); -
trunk/Upload/includes/classes/class_skin.php
r73 r74 22 22 class td_class_skin { 23 23 24 p rivate$data;24 public $data; 25 25 private $smarty; 26 26 … … 240 240 241 241 $this->set_var( 'user', &$this->trellis->user ); 242 $this->set_var( 'cache', &$this->trellis->cache->data); # TODO: let's try to all cache references in templates for speed242 $this->set_var( 'cache', array( 'settings' => &$this->trellis->cache->data['settings'] ) ); # TODO: let's try to all cache references in templates for speed 243 243 $this->set_var( 'input', &$this->trellis->input ); 244 244 -
trunk/Upload/includes/css/tiburon.css
r73 r74 509 509 padding: 0; 510 510 margin: 0 0 12px 0; 511 } 512 513 .rollstart a, 514 .rollcustomer a { 515 color: #36567f; 516 border-bottom: 1px dotted #92acc8; 517 text-decoration: none; 518 } 519 520 .rollstaff a { 521 color: #3c5311; 522 border-bottom: 1px dotted #99b070; 523 text-decoration: none; 524 } 525 526 .rollstaffonly a { 527 color: #7f291e; 528 border-bottom: 1px dotted #ca827c; 529 text-decoration: none; 511 530 } 512 531 -
trunk/Upload/includes/functions/func_articles.php
r73 r74 20 20 */ 21 21 22 class td_func_articles { 23 24 public $error = ''; 22 class td_func_articles extends td_func_template { 25 23 26 24 #======================================= … … 216 214 $id = $this->trellis->db->get_insert_id(); 217 215 218 $this->trellis->db->construct( array( 219 'update' => 'articles', 220 'set' => array( 'comments' => array( '+', 1 ) ), 221 'where' => array( 'id', '=', $aid ), 222 'limit' => array( 1 ), 223 ) ); 216 $this->increase_count( $aid, 1, 'comments' ); 217 218 return $id; 219 } 220 221 #======================================= 222 # @ Add Rating 223 #======================================= 224 225 public function add_rating($amount, $aid, $params=array()) 226 { 227 if ( ! $amount = intval( $amount ) ) return false; 228 if ( ! $aid = intval( $aid ) ) return false; 229 230 $sql_select = array(); 231 232 if ( ! isset( $params['rating_total'] ) ) $sql_select[] = 'rating_total'; 233 if ( ! isset( $params['votes'] ) ) $sql_select[] = 'votes'; 234 235 if ( ! empty( $sql_select ) ) 236 { 237 if ( ! $a = $this->get_single_by_id( array( 'select' => $sql_select ), $id ) ) return false; 238 } 239 240 if ( ! isset( $params['rating_total'] ) ) $params['rating_total'] = $a['rating_total']; 241 if ( ! isset( $params['votes'] ) ) $params['votes'] = $a['votes']; 242 243 $db_array = array( 244 'aid' => $aid, 245 'uid' => $this->trellis->user['id'], 246 'rating' => $amount, 247 'date' => time(), 248 'ipadd' => $this->trellis->input['ip_address'], 249 ); 250 251 $this->trellis->db->construct( array( 252 'insert' => 'article_rate', 253 'set' => $db_array, 254 ) ); 255 256 $this->trellis->db->execute(); 257 258 $id = $this->trellis->db->get_insert_id(); 259 260 $new_total = $params['rating_total'] + $amount; 261 $new_average = round( ( $new_total ) / ( $params['votes'] + 1 ), 2 ); 262 263 $this->trellis->db->construct( array( 264 'update' => 'articles', 265 'set' => array( 'rating_average' => $new_average, 'rating_total' => $new_total, 'votes' => ( $params['votes'] + 1 ) ), 266 'where' => array( 'id', '=', $aid ), 267 'limit' => array( 1 ), 268 ) ); 224 269 225 270 $this->trellis->db->execute(); … … 346 391 $dc = $this->trellis->db->get_affected_rows(); 347 392 348 $this->trellis->db->construct( array( 349 'update' => 'articles', 350 'set' => array( 'comments' => array( '-', 1 ) ), 351 'where' => array( 'id', '=', $params['aid'] ), 352 'limit' => array( 1 ), 353 ) ); 354 355 $this->trellis->db->next_shutdown(); 356 $this->trellis->db->execute(); 393 $this->decrease_count( $params['aid'], 1, 'comments' ); 357 394 358 395 return $dc; 359 396 } 360 397 398 #======================================= 399 # @ Increase Count 400 #======================================= 401 402 public function increase_count($id, $amount, $field, $now=0) 403 { 404 $this->update_stats( $id, $amount, 'articles', $field, 'increase', $now ); 405 } 406 407 #======================================= 408 # @ Decrease Count 409 #======================================= 410 411 public function decrease_count($id, $amount, $field, $now=0) 412 { 413 $this->update_stats( $id, $amount, 'articles', $field, 'decrease', $now ); 414 } 415 361 416 } 362 417 -
trunk/Upload/includes/functions/func_rebuild.php
r73 r74 123 123 $to_cache = array(); 124 124 125 if ( ! $limit ) $limit = $this->trellis->cache->data['settings']['news'][' portal_amount'];126 127 $this->trellis->db->construct( array( 128 'select' => array( 'id', 'title', 'excerpt', ' content', 'date' ),125 if ( ! $limit ) $limit = $this->trellis->cache->data['settings']['news']['dashboard_amount']; 126 127 $this->trellis->db->construct( array( 128 'select' => array( 'id', 'title', 'excerpt', 'date' ), 129 129 'from' => 'news', 130 130 'order' => array( 'date' => 'desc' ), … … 136 136 while ( $a = $this->trellis->db->fetch_row() ) 137 137 { 138 if ( ! $a['excerpt'] )139 {140 if ( $this->trellis->cache->data['settings']['news']['rte'] )141 {142 if ( $this->trellis->cache->data['settings']['news']['excerpt_trim'] )143 {144 $a['excerpt'] = $this->trellis->shorten_str( $this->trellis->remove_html( $this->trellis->remove_dbl_spaces( $this->trellis->convert_html( $a['content'] ) ) ), $this->trellis->cache->data['settings']['news']['excerpt_trim'], 1 );145 }146 else147 {148 $a['excerpt'] = $this->trellis->remove_html( $this->trellis->remove_dbl_spaces( $this->trellis->convert_html( $a['content'] ) ) );149 }150 }151 else152 {153 if ( $this->trellis->cache->data['settings']['news']['excerpt_trim'] )154 {155 $a['excerpt'] = $this->trellis->shorten_str( $a['content'], $this->trellis->cache->data['settings']['news']['excerpt_trim'], 1 );156 }157 else158 {159 $a['excerpt'] = $a['content'];160 }161 }162 }163 164 unset( $a['content'] );165 166 138 $to_cache[ $a['id'] ] = $a; 167 139 } -
trunk/Upload/includes/trellis.php
r73 r74 80 80 81 81 $this->db = new td_class_db_mysql( array( 'host' => $this->config['db_host'], 'user' => $this->config['db_user'], 'pass' => $this->config['db_pass'], 'name' => $this->config['db_name'], 'prefix' => $this->config['db_prefix'], 'shutdown_queries' => $this->config['db_shutdown_queries'] ) ); 82 83 #============================= 84 # Load Templates 85 #============================= 86 87 require_once HD_FUNC .'template.php'; 82 88 } 83 89 … … 210 216 if( ! $this->func->$name ) 211 217 { 212 if ( file_exists( HD_ INC .'functions/func_'. $name .'.php' ) )218 if ( file_exists( HD_FUNC . $name .'.php' ) ) 213 219 { 214 require_once HD_ INC .'functions/func_'. $name .'.php';220 require_once HD_FUNC . $name .'.php'; 215 221 216 222 $class_name = 'td_func_'. $name; … … 566 572 if ( ! $this->htmlpurifier ) require_once HD_INC .'htmlpurifier/HTMLPurifier.standalone.php'; 567 573 568 $key = base64_encode( serialize( array( 'html' => $params['html'], ' linkify' => $params['linkify'] ) ) );574 $key = base64_encode( serialize( array( 'html' => $params['html'], 'paragraphs' => $params['paragraphs'], 'linkify' => $params['linkify'] ) ) ); 569 575 570 576 if ( ! $this->htmlp_configs[ $key ] ) … … 577 583 if ( ! $params['html'] ) 578 584 { 579 $config->set( 'AutoFormat.AutoParagraph', true ); 585 if ( $params['paragraphs'] ) $config->set( 'AutoFormat.AutoParagraph', true ); 586 580 587 $config->set( 'HTML.Allowed', 'p,br,a[href]' ); 581 588 … … 1284 1291 1285 1292 #======================================= 1286 # @ Check Token1287 # Check form token with database.1288 #=======================================1289 1290 function check_token($type)1291 {1292 if ( $this->cache->data['settings']['security']['form_tokens'] )1293 {1294 if ( $this->cache->data['settings']['security']['token_ip_check'] )1295 {1296 $sql_where = array( array( 'token', '=', $this->input['token'] ), array( 'type', '=', $type, 'and' ), array( 'ipadd', '=', $this->input['ip_address'], 'and' ) );1297 }1298 else1299 {1300 $sql_where = array( array( 'token', '=', $this->input['token'] ), array( 'type', '=', $type, 'and' ) );1301 }1302 1303 $this->db->construct( array(1304 'select' => array( 'id' ),1305 'from' => 'tokens',1306 'where' => $sql_where,1307 'limit' => array( 0, 1 ),1308 ) );1309 1310 $this->db->execute();1311 1312 if ( $this->db->get_num_rows() )1313 {1314 $this->db->construct( array(1315 'delete' => 'tokens',1316 'where' => array( 'token', '=', $this->input['token'] ),1317 'limit' => array( 1 ),1318 ) );1319 1320 $this->db->next_shutdown();1321 $this->db->execute();1322 1323 return TRUE;1324 }1325 else1326 {1327 $this->skin->error('token_mismatch');1328 }1329 }1330 else1331 {1332 return TRUE;1333 }1334 }1335 1336 #=======================================1337 1293 # @ Check Ticket Auto Close 1338 1294 # Check tickets for ones that need to -
trunk/Upload/install/index.php
r37 r74 1796 1796 @import "../includes/local.css"; 1797 1797 </style> 1798 <script src='../includes/scripts/ global.js' type='text/javascript'></script>1798 <script src='../includes/scripts/common.js' type='text/javascript'></script> 1799 1799 <script src='../includes/scripts/prototype.js' type='text/javascript'></script> 1800 1800 <script src='../includes/scripts/scriptaculous.js' type='text/javascript'></script> -
trunk/Upload/language/en/lang_global.php
r64 r74 14 14 'account_info' => 'Account Information', 15 15 'admin' => 'Admin', 16 'announcements' => 'Announcements',17 16 'bytes' => 'Bytes', 18 17 'closed' => 'Closed', … … 89 88 'submitted' => 'Submitted', 90 89 'ticket_history' => 'Ticket History', 91 'ticket _overview' => 'TicketOverview',90 'tickets_overview' => 'Tickets Overview', 92 91 'tickets' => 'Tickets', 93 92 'today' => 'Today', … … 106 105 'guest_tag' => '(Guest)', 107 106 'antispam_captcha' => 'Captcha', 107 'read_on' => 'Click to read...', 108 'no_excerpt' => 'No excerpt', 108 109 109 110 ); -
trunk/Upload/language/en/lang_knowledgebase.php
r21 r74 34 34 'sub_categories' => 'Sub-Categories', 35 35 'no_description' => 'No description', 36 'alert_rating_added' => 'Your rating has been successfully added.', 36 37 37 38 ); -
trunk/Upload/skin/s1/acc_change_email.tpl
r20 r74 18 18 <div class="formtail"><input type="submit" name="submit" id="change" value="{$lang['change_email_button']}" class="button" /></div> 19 19 </form> 20 <script type="text/javascript">21 {lv_field name="new_email"}22 {lv_rule name="new_email" type="presence"}23 {lv_rule name="new_email" type="email"}24 {lv_field name="new_email_b"}25 {lv_rule name="new_email_b" type="presence"}26 {lv_rule name="new_email_b" type="email"}27 {lv_rule name="new_email_b" type="match" against="new_email"}28 {focus name="new_email"}29 </script>30 20 </div> 21 <script type="text/javascript"> 22 //<![CDATA[ 23 {lv_field name="new_email"} 24 {lv_rule name="new_email" type="presence"} 25 {lv_rule name="new_email" type="email"} 26 {lv_field name="new_email_b"} 27 {lv_rule name="new_email_b" type="presence"} 28 {lv_rule name="new_email_b" type="email"} 29 {lv_rule name="new_email_b" type="match" against="new_email"} 30 {focus name="new_email"} 31 //]]> 32 </script> -
trunk/Upload/skin/s1/acc_change_pass.tpl
r20 r74 22 22 <div class="formtail"><input type="submit" name="submit" id="change" value="{$lang['change_pass_button']}" class="button" /></div> 23 23 </form> 24 <script type="text/javascript">25 {lv_field name="current_pass"}26 {lv_rule name="current_pass" type="presence"}27 {lv_field name="new_pass"}28 {lv_rule name="new_pass" type="presence"}29 {lv_field name="new_pass_b"}30 {lv_rule name="new_pass_b" type="presence"}31 {lv_rule name="new_pass_b" type="match" against="new_pass"}32 {focus name="current_pass"}33 </script>34 24 </div> 25 <script type="text/javascript"> 26 //<![CDATA[ 27 {lv_field name="current_pass"} 28 {lv_rule name="current_pass" type="presence"} 29 {lv_field name="new_pass"} 30 {lv_rule name="new_pass" type="presence"} 31 {lv_field name="new_pass_b"} 32 {lv_rule name="new_pass_b" type="presence"} 33 {lv_rule name="new_pass_b" type="match" against="new_pass"} 34 {focus name="current_pass"} 35 //]]> 36 </script> -
trunk/Upload/skin/s1/acc_modify.tpl
r73 r74 98 98 {if $validate} 99 99 <script type="text/javascript"> 100 //<![CDATA[ 100 101 {foreach $validate as $f} 101 102 {lv_field name=$f} 102 103 {lv_rule name=$f type="presence"} 103 104 {/foreach} 105 //]]> 104 106 </script> 105 107 {/if} -
trunk/Upload/skin/s1/dashboard.tpl
r44 r74 3 3 <tr> 4 4 <td width="1%" style="padding:0 8px 7px 8px"> 5 <a href="{$td_url}/index.php?page=tickets&a ct=open"><img src="{$img_url}/ticket_icon.gif" alt="{$lang['open_ticket']}" /></a>5 <a href="{$td_url}/index.php?page=tickets&act=open"><img src="{$img_url}/ticket_icon.gif" alt="{$lang['open_ticket']}" /></a> 6 6 </td> 7 7 <td width="46%"> 8 <span class="blbig"><a href="{$td_url}/index.php?page=tickets&a ct=open">{$lang['open_ticket']}</a></span>8 <span class="blbig"><a href="{$td_url}/index.php?page=tickets&act=open">{$lang['open_ticket']}</a></span> 9 9 </td> 10 10 {if $cache['settings']['kb']['enable'] && $user['g_kb_access']} … … 17 17 {else} 18 18 <td width="1%" style="padding:0 8px 7px 8px"> 19 <a href="{$td_url}/index.php?page=tickets&a ct=history"><img src="{$img_url}/kb_icon.gif" alt="{$lang['ticket_history']}" /></a>19 <a href="{$td_url}/index.php?page=tickets&act=history"><img src="{$img_url}/kb_icon.gif" alt="{$lang['ticket_history']}" /></a> 20 20 </td> 21 21 <td width="52%"> 22 <span class="blbig"><a href="{$td_url}/index.php?page=tickets&a ct=history">{$lang['ticket_history']}</a></span>22 <span class="blbig"><a href="{$td_url}/index.php?page=tickets&act=history">{$lang['ticket_history']}</a></span> 23 23 </td> 24 24 {/if} … … 27 27 <tr> 28 28 <td colspan="4"> 29 <div class="groupbox">{if $cache['settings']['news']['page']}<a href="{$td_url}/index.php?page=news">{/if}{$lang[' announcements']}{if $cache['settings']['news']['page']}</a>{/if}</div>29 <div class="groupbox">{if $cache['settings']['news']['page']}<a href="{$td_url}/index.php?page=news">{/if}{$lang['news']}{if $cache['settings']['news']['page']}</a>{/if}</div> 30 30 {foreach $news as $n} 31 <div class="subbox">{if $cache['settings']['news']['page']}<a href="{$td_url}/index.php?page=news&a ct=view&id={$n['id']}">{/if}{$n['title']}{if $cache['settings']['news']['page']}</a>{/if}<span class="date"> -- {$n['date']}</span></div>31 <div class="subbox">{if $cache['settings']['news']['page']}<a href="{$td_url}/index.php?page=news&act=view&id={$n['id']}">{/if}{$n['title']}{if $cache['settings']['news']['page']}</a>{/if}<span class="date"> -- {$n['date_human']}</span></div> 32 32 <div class="row1"> 33 {if $n['excerpt']} 33 34 {$n['excerpt']} 35 {else} 36 {if $cache['settings']['news']['page']}<a href="{$td_url}/index.php?page=news&act=view&id={$n['id']}">{$lang['read_on']}</a>{else}<i>{$lang['no_excerpt']}</i>{/if} 37 {/if} 34 38 </div> 35 39 {/foreach} … … 40 44 <tr> 41 45 <td colspan="4"> 42 <div class="groupbox">{$lang['ticket _overview']}</div>46 <div class="groupbox">{$lang['tickets_overview']}</div> 43 47 <table width="100%" cellpadding="3" cellspacing="0" class="smtable"> 44 48 <tr> … … 52 56 {if $user['id'] or $user['s_tkey']} 53 57 {if $tickets} 58 {$ticket_rows = 0} 54 59 {foreach $tickets as $t} 60 {$ticket_rows = $ticket_rows+1} 61 {if $ticket_rows & 1}{$ticket_class = 1}{else}{$ticket_class = 2}{/if} 55 62 <tr> 56 <td class="option{$t ['class']}-mini"><a href="{$td_url}/index.php?page=tickets&act=view&id={$t['mask']}">{$t['mask']}</a></td>57 <td class="option{$t ['class']}-mini"><a href="{$td_url}/index.php?page=tickets&act=view&id={$t['mask']}">{if $t['escalated']}<img src='{$img_url}/icon_escalate.png' alt='E' style='vertical-align:middle;margin-bottom:2px' /> {/if}{$t['subject']}</a></td>58 <td class="option{$t ['class']}-mini"><img src="{$td_url}/images/priorities/{$t['icon_regular']}" alt="{$t['pname']}" class="prioritybox" /> {$t['pname']}</td>59 <td class="row{$t ['class']}-mini">{$t['dname']}</td>60 <td class="row{$t ['class']}-mini">{$t['last_reply']}</td>61 <td class="option{$t ['class']}-mini">{$t['status_abbr']}</td>63 <td class="option{$ticket_class}-mini"><a href="{$td_url}/index.php?page=tickets&act=view&id={$t['mask']}">{$t['mask']}</a></td> 64 <td class="option{$ticket_class}-mini"><a href="{$td_url}/index.php?page=tickets&act=view&id={$t['mask']}">{if $t['escalated']}<img src='{$img_url}/icon_escalate.png' alt='E' style='vertical-align:middle;margin-bottom:2px' /> {/if}{$t['subject']}</a></td> 65 <td class="option{$ticket_class}-mini"><img src="{$td_url}/images/priorities/{$t['icon_regular']}" alt="{$t['pname']}" class="prioritybox" /> {$t['pname']}</td> 66 <td class="row{$ticket_class}-mini">{$t['dname']}</td> 67 <td class="row{$ticket_class}-mini">{$t['last_reply_human']}</td> 68 <td class="option{$ticket_class}-mini">{$t['status_abbr']}</td> 62 69 </tr> 63 70 {/foreach} … … 84 91 <div class="row1"> 85 92 {foreach $recent_articles as $a} 86 <a href="{$td_url}/index.php?page=kb&a ct=view&id={$a['id']}" title="{$a['description']}">{$a['title']}</a><br />93 <a href="{$td_url}/index.php?page=kb&act=view&id={$a['id']}" title="{$a['description']}">{$a['title']}</a><br /> 87 94 {/foreach} 88 95 </div> … … 94 101 <div class="row1"> 95 102 {foreach $popular_articles as $a} 96 <a href="{$td_url}/index.php?page=kb&a ct=view&id={$a['id']}" title="{$a['description']}">{$a['title']}</a><br />103 <a href="{$td_url}/index.php?page=kb&act=view&id={$a['id']}" title="{$a['description']}">{$a['title']}</a><br /> 97 104 {/foreach} 98 105 </div> -
trunk/Upload/skin/s1/kb_article.tpl
r25 r74 1 <script type="text/javascript">2 function amirate(rate)3 {4 rating = Math.round(rate);5 6 for ( x = 1; x < rate + 1; x++ )7 {8 document.images["rate"+x].src = "{$img_url}/rate_hover.gif";9 }10 }11 function unamirate(rating)12 {13 rating = Math.round(rating);14 15 for ( x = 1; x <= rating; x++ )16 {17 document.images["rate"+x].src = "{$img_url}/rate_on.gif";18 }19 20 for ( x = x; x <= 5; x++ )21 {22 document.images["rate"+x].src = "{$img_url}/rate_off.gif";23 }24 }25 function validate_form(form)26 {27 if ( ! form.comment.value )28 {29 alert("{$lang['err_no_comment']}");30 form.comment.focus();31 return false;32 }33 }34 function sure_delete()35 {36 if ( confirm("{$lang['confirm_delete']}") )37 {38 return true;39 }40 else41 {42 return false;43 }44 }45 </script>46 1 <div class="content_block"> 47 2 <h1>{$lang['viewing_article']}</h1> 3 {if $alert}<div class="alert">{$alert}</div>{/if} 48 4 <div class="groupbox"><div style="float:right">{$rate} | {$a['date_human']} | <a href="{$td_url}/index.php?page=kb&act=print&id={$a['id']}">{$lang['print']}</a></div>{$a['title']}</div> 49 <div class="row1 ">5 <div class="row1 post"> 50 6 {$a['content']} 51 7 </div> 52 8 53 9 {if $comments} 10 {$comments_count = 0} 54 11 {foreach $comments as $c} 12 {$comments_count = $comments_count+1} 13 {if $comments_count & 1}{$comments_class = 2}{else}{$comments_class = 1}{/if} 55 14 <a name="com{$c['id']}"></a> 56 <div class="subbox{$c['class_staff']}"><div class="links" style="float:right">{$c['time_ago']}{if $user['g_kb_com_edit'] && $c['uid'] == $user['id']} <a href="{$td_url}/index.php?page=kb&act=editcomment&id={$c['id']}"><img src="{$img_url}/edit_icon.gif" alt="{$lang['edit']}" id="edit_{$c['id']}" style="vertical-align: middle" /></a>{/if}{if $user['g_kb_com_delete'] && $c['uid'] == $user['id']} <a href="{$td_url}/index.php?page=kb&act=dodeletecomment&id={$c['id']}" onclick="return sure_delete()"><img src="{$img_url}/delete_icon.gif" alt="{$lang['delete']}" id="delete_{$c['id']}" style="vertical-align: middle" /></a>{/if}</div>{$c['uname']} -- {$c['date']}</div> 57 <div class="row{$c['class']}"> 15 <div class="subbox{if $c['staff']}staff{/if}"> 16 <div class="links" style="float:right">{$c['time_ago']}{if $c['can_edit']} <a href="{$td_url}/index.php?page=kb&act=editcomment&id={$c['id']}"><img src="{$img_url}/edit_icon.gif" alt="{$lang['edit']}" id="edit_{$c['id']}" style="vertical-align: middle" /></a>{/if}{if $c['can_delete']} <a href="{$td_url}/index.php?page=kb&act=dodeletecomment&id={$c['id']}" onclick="return sure_delete()"><img src="{$img_url}/delete_icon.gif" alt="{$lang['delete']}" id="delete_{$c['id']}" style="vertical-align: middle" /></a>{/if} 17 </div>{$c['uname']} -- {$c['date_human']} 18 </div> 19 <div class="row{$comments_class} post"> 58 20 {$c['message']} 59 21 </div> 60 22 {/foreach}<br /> 61 {elseif $ cache['settings']['kb']['allow_comments'] && ! $a['dis_comments']}23 {elseif $a['can_comment']} 62 24 <div class="option2-mini">{$lang['no_comments']}</div> 63 25 {/if} 64 26 65 {if $ show_comment_form}27 {if $a['can_comment']} 66 28 <br /> 67 {if $error} 68 <div class="critical">{$error}</div> 69 {/if} 29 {if $error}<div class="critical">{$error}</div>{/if} 70 30 <div class="groupbox">{$lang['add_a_comment']}</div> 71 <form action="{$td_url}/index.php?page=kb&act=doaddcomment&id={$a['id']}" method="post" onsubmit="return validate_form(this)">31 <form action="{$td_url}/index.php?page=kb&act=doaddcomment&id={$a['id']}" method="post"> 72 32 <div class="option1"><textarea name="message" id="message" rows="6" cols="100" style="width: 98%; height: 100px;">{$input['message']}</textarea></div> 73 33 <div class="formtail"><input type="submit" name="submit" id="send" value="{$lang['add_comment_button']}" class="button" /></div> … … 75 35 {/if} 76 36 </div> 37 <script type="text/javascript"> 38 //<![CDATA[ 39 function amirate(rate) { 40 rating = Math.round(rate); 41 42 for ( x = 1; x < rate + 1; x++ ) { 43 document.images["rate"+x].src = "{$img_url}/rate_hover.gif"; 44 } 45 } 46 function unamirate(rating) { 47 rating = Math.round(rating); 48 49 for ( x = 1; x <= rating; x++ ) { 50 document.images["rate"+x].src = "{$img_url}/rate_on.gif"; 51 } 52 53 for ( x = x; x <= 5; x++ ) { 54 document.images["rate"+x].src = "{$img_url}/rate_off.gif"; 55 } 56 } 57 function sure_delete() { 58 if ( confirm("{$lang['confirm_delete']}") ) { 59 return true; 60 } 61 else { 62 return false; 63 } 64 } 65 //]]> 66 </script> -
trunk/Upload/skin/s1/wrapper.tpl
r71 r74 6 6 <link href="{$tpl_url}/style.css" rel="stylesheet" type="text/css" media="all" /> 7 7 <script src="{$td_url}/includes/jquery/js/jquery.js" type="text/javascript"></script> 8 <script src="{$td_url}/includes/scripts/ global.js" type="text/javascript"></script>8 <script src="{$td_url}/includes/scripts/common.js" type="text/javascript"></script> 9 9 <script src="{$td_url}/includes/scripts/livevalidation.js" type="text/javascript"></script> 10 10 </head> -
trunk/Upload/skin/s2/wrapper.tpl
r11 r74 5 5 <title>{$title}</title> 6 6 <link href='{$tpl_url}/style.css' rel='stylesheet' type='text/css' media='all' /> 7 <script src='{$td_url}/includes/scripts/ global.js' type='text/javascript'></script>7 <script src='{$td_url}/includes/scripts/common.js' type='text/javascript'></script> 8 8 </head> 9 9 <body> -
trunk/Upload/sources/account.php
r73 r74 122 122 #============================= 123 123 124 if ( $alert ) 125 { 126 $this->trellis->skin->set_var( 'alert', $this->trellis->lang[ 'alert_'. $alert ] ); 127 } 124 if ( $alert ) $this->trellis->skin->set_var( 'alert', $this->trellis->lang[ 'alert_'. $alert ] ); 128 125 129 126 $this->trellis->skin->set_var( 'sub_tpl', 'account.tpl' ); … … 271 268 #============================= 272 269 273 if ( $error ) 274 { 275 $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 276 } 270 if ( $error ) $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 277 271 278 272 $this->nav = array( … … 332 326 #============================= 333 327 334 if ( $error ) 335 { 336 $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 337 } 328 if ( $error ) $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 338 329 339 330 $this->nav = array( -
trunk/Upload/sources/dashboard.php
r64 r74 32 32 #============================= 33 33 34 if ( $this->trellis->cache->data['settings']['news']['enable'] && $this->trellis->cache->data['settings']['news'][' portal'] )34 if ( $this->trellis->cache->data['settings']['news']['enable'] && $this->trellis->cache->data['settings']['news']['dashboard'] ) 35 35 { 36 $final_a = array();37 $row_count = 0;38 $news = 0;39 40 36 if ( ! empty( $this->trellis->cache->data['news'] ) ) 41 37 { 42 while ( list( $id, $a ) = each( $this->trellis->cache->data['news'] ) ) 38 $news = array(); 39 40 foreach( $this->trellis->cache->data['news'] as $n ) 43 41 { 42 $news[ $n['id'] ] = $n; 43 44 44 #============================= 45 45 # Fix Up Information 46 46 #============================= 47 47 48 $row_count ++; 49 50 ( $row_count & 1 ) ? $a['class'] = 1 : $a['class'] = 2; 51 52 $a['date'] = $this->trellis->td_timestamp( array( 'time' => $a['date'], 'format' => 'short' ) ); 53 54 $final_a[] = $a; 48 $news[ $n['id'] ]['date_human'] = $this->trellis->td_timestamp( array( 'time' => $a['date'], 'format' => 'short' ) ); 55 49 } 56 50 57 $this->trellis->skin->set_var( 'news', $ final_a);51 $this->trellis->skin->set_var( 'news', $news ); 58 52 } 59 53 } … … 101 95 102 96 $ticket_rows = array(); 103 $row_count = 0;104 97 105 98 if ( $tickets ) … … 111 104 #============================= 112 105 113 $row_count ++; 114 115 ( $row_count & 1 ) ? $t['class'] = 1 : $t['class'] = 2; 116 117 if ( $t['date'] ) $t['date'] = $this->trellis->td_timestamp( array( 'time' => $t['date'], 'format' => 'short' ) ); 118 if ( $t['last_reply'] ) $t['last_reply'] = $this->trellis->td_timestamp( array( 'time' => $t['last_reply'], 'format' => 'short' ) ); 106 if ( $t['date'] ) $t['date_human'] = $this->trellis->td_timestamp( array( 'time' => $t['date'], 'format' => 'short' ) ); 107 if ( $t['last_reply'] ) $t['last_reply_human'] = $this->trellis->td_timestamp( array( 'time' => $t['last_reply'], 'format' => 'short' ) ); 119 108 120 109 if ( ! $t['status_abbr'] ) $t['status_abbr'] = $t['status_name']; -
trunk/Upload/sources/knowledgebase.php
r48 r74 16 16 | @ Build: <#TAG_VER_BUILD_TAG#> 17 17 #====================================================== 18 | | Knowledge Base :: Sources18 | | Sources :: Knowledge Base 19 19 #====================================================== 20 20 */ 21 21 22 class knowledgebase {22 class td_source_knowledgebase { 23 23 24 24 #======================================= 25 25 # @ Auto Run 26 # Function that is run automatically27 # when the file is required.28 26 #======================================= 29 27 … … 31 29 { 32 30 #============================= 31 # Security Checks 32 #============================= 33 34 if ( ! $this->trellis->cache->data['settings']['kb']['enable'] ) $this->trellis->skin->error('kb_disabled'); 35 36 if ( ! $this->trellis->user['g_kb_access'] || $this->trellis->user['ban_kb'] ) 37 { 38 $this->trellis->log( 'security', "Blocked Access Knowledge Base" ); 39 40 $this->trellis->skin->error('banned_kb'); 41 } 42 43 #============================= 33 44 # Initialize 34 45 #============================= 35 36 if ( ! $this->trellis->cache->data['settings']['kb']['enable'] )37 {38 $this->trellis->skin->error('kb_disabled');39 }40 41 if ( ! $this->trellis->user['g_kb_access'] || $this->trellis->user['ban_kb'] )42 {43 $this->trellis->log( 'security', "Blocked Access Knowledge Base" );44 45 $this->trellis->skin->error('banned_kb');46 }47 46 48 47 $this->trellis->load_lang('knowledgebase'); … … 59 58 $this->do_search(); 60 59 break; 61 case 'rate':62 $this->do_rate();63 break;64 60 65 61 case 'editcomment': … … 75 71 case 'dodeletecomment': 76 72 $this->do_delete_comment(); 73 break; 74 case 'dorate': 75 $this->do_rate(); 77 76 break; 78 77 … … 124 123 $this->trellis->load_functions('categories'); 125 124 126 if ( ! $c = $this->trellis->func->categories->get_single_by_id( array( 'id', 'name', 'description', 'articles' ), $this->trellis->input['id'] ) ) 127 { 128 $this->trellis->skin->error('no_category'); 129 } 125 if ( ! $c = $this->trellis->func->categories->get_single_by_id( array( 'id', 'name', 'description', 'articles' ), $this->trellis->input['id'] ) ) $this->trellis->skin->error('no_category'); 130 126 131 127 $this->trellis->skin->set_var( 'c', $c ); … … 167 163 #======================================= 168 164 169 private function view_article($ error="", $type="")165 private function view_article($alert="", $error="") 170 166 { 171 167 #============================= … … 175 171 $this->trellis->load_functions('articles'); 176 172 177 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'description', 'content', 'rating ', 'votes', 'views', 'comments', 'html', 'date', 'modified', 'allow_comments', 'allow_rating' ), $this->trellis->input['id'] ) )173 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'description', 'content', 'rating_average', 'votes', 'views', 'comments', 'html', 'date', 'modified', 'allow_comments', 'allow_rating' ), $this->trellis->input['id'] ) ) 178 174 { 179 175 $this->trellis->log( 'error', "Article Not Found ID: ". $this->trellis->input['id'] ); … … 188 184 $a['date_human'] = $this->trellis->td_timestamp( array( 'time' => $a['date'], 'format' => 'short' ) ); 189 185 190 $aoutput_params = array( 'urls' => 1 ); 191 192 ( $a['html'] ) ? $aoutput_params['html'] = 1 : $aoutput_params['nl2br'] = 1; 186 $aoutput_params = array( 'linkify' => 1 ); 187 188 if ( $a['html'] ) 189 { 190 $aoutput_params['html'] = 1; 191 } 192 else 193 { 194 $aoutput_params['paragraphs'] = 1; 195 $aoutput_params['nl2br'] = 1; 196 } 193 197 194 198 $a['content'] = $this->trellis->prepare_output( $a['content'], $aoutput_params ); 195 199 196 $this->trellis->skin->set_var( 'a', $a );197 198 200 #============================= 199 201 # Can We Rate? 200 202 #============================= 201 203 202 if ( $this->trellis-> user['id'] )203 { 204 if ( $this->trellis-> func->articles->get_single_rating( array( 'id' ), array( 'uid', '=', $this->trellis->user['id'], 'and' ) ) || ! $this->trellis->cache->data['settings']['kb']['rating'] || ! $this->trellis->user['g_kb_rate'] || ! $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_rating'] || ! $a['allow_rating'] )204 if ( $this->trellis->cache->data['settings']['kb']['rating'] && $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_rating'] && $a['allow_rating'] ) 205 { 206 if ( $this->trellis->user['id'] && $this->trellis->user['g_kb_rate'] ) # TODO: allow guests to rate 205 207 { 206 $rate = $this->rate_stars( $a['rating'], 0, $a['id'] ); 208 if ( $this->trellis->func->articles->get_single_rating( array( 'id' ), array( array( 'aid', '=', $a['id'] ), array( 'uid', '=', $this->trellis->user['id'], 'and' ) ) ) ) 209 { 210 $rate = $this->rate_stars( $a['rating_average'], 0, $a['id'] ); 211 } 212 else 213 { 214 $rate = $this->rate_stars( $a['rating_average'], 1, $a['id'] ); 215 } 207 216 } 208 217 else 209 218 { 210 $rate = $this->rate_stars( $a['rating '], 1, $a['id'] );219 $rate = $this->rate_stars( $a['rating_average'], 0, $a['id'] ); 211 220 } 212 } 213 else 214 { 215 $rate = $this->rate_stars( $a['rating'], 0, $a['id'] ); 216 } 217 218 $this->trellis->skin->set_var( 'rate', $rate ); 221 222 $this->trellis->skin->set_var( 'rate', $rate ); 223 } 219 224 220 225 #============================= … … 235 240 if ( $comments ) 236 241 { 237 $row_count = 0; // Initialize for Security238 239 242 foreach ( $comments as $c ) 240 243 { … … 243 246 #============================= 244 247 245 $row_count ++;246 247 ( $row_count & 1 ) ? $comments[ $c['id'] ]['class'] = 1 : $comments[ $c['id'] ]['class'] = 2;248 249 if ( $c['staff'] ) $comments[ $c['id'] ]['class_staff'] = 'staff';250 251 248 $comments[ $c['id'] ]['time_ago'] = $this->trellis->td_timestamp( array( 'time' => $comments[ $c['id'] ]['date'], 'format' => 'relative' ) ); 252 249 253 $comments[ $c['id'] ]['date'] = $this->trellis->td_timestamp( array( 'time' => $comments[ $c['id'] ]['date'], 'format' => 'short' ) ); 254 255 $coutput_params = array( 'urls' => 1 ); 256 257 ( $c['html'] ) ? $coutput_params['html'] = 1 : $coutput_params['nl2br'] = 1; 250 $comments[ $c['id'] ]['date_human'] = $this->trellis->td_timestamp( array( 'time' => $comments[ $c['id'] ]['date'], 'format' => 'short' ) ); 251 252 $coutput_params = array( 'linkify' => 1 ); 253 254 if ( $c['html'] ) 255 { 256 $coutput_params['html'] = 1; 257 } 258 else 259 { 260 $coutput_params['paragraphs'] = 1; 261 $coutput_params['nl2br'] = 1; 262 } 263 264 // Permissions for Templates 265 if ( $c['uid'] == $this->trellis->user['id'] ) 266 { 267 if ( $this->trellis->user['g_kb_com_edit'] ) $comments[ $c['id'] ]['can_edit'] = 1; 268 if ( $this->trellis->user['g_kb_com_delete'] ) $comments[ $c['id'] ]['can_delete'] = 1; 269 } 258 270 259 271 $comments[ $c['id'] ]['message'] = $this->trellis->prepare_output( $c['message'], $coutput_params ); … … 264 276 265 277 #============================= 278 # Stats 279 #============================= 280 281 $this->trellis->func->articles->increase_count( $a['id'], 1, 'views' ); 282 283 #============================= 266 284 # Do Output 267 285 #============================= 268 286 269 if ( $this->trellis->cache->data['settings']['kb']['comments'] && $this->trellis->user['g_kb_comment'] && $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_comments'] && $a['allow_comments'] ) 270 { 271 $this->trellis->skin->set_var( 'show_comment_form', 1 ); 272 273 if ( $error ) 274 { 275 $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 276 } 277 } 278 279 #============================= 280 # Update Article 281 #============================= 282 283 $this->trellis->db->construct( array( 284 'update' => 'articles', 285 'set' => array( 'views' => $a['views'] + 1 ), 286 'where' => array( 'id', '=', $a['id'] ), 287 'limit' => array( 1 ), 288 ) ); 289 290 $this->trellis->db->next_shutdown(); 291 $this->trellis->db->execute(); 292 293 #============================= 294 # Do Output 295 #============================= 287 if ( $error ) $this->trellis->skin->set_var( 'error', $this->trellis->lang[ 'err_'. $error ] ); 288 if ( $alert ) $this->trellis->skin->set_var( 'alert', $this->trellis->lang[ 'alert_'. $alert ] ); 289 290 // Permissions for Templates 291 if ( $this->trellis->cache->data['settings']['kb']['comments'] && $this->trellis->user['g_kb_comment'] && $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_comments'] && $a['allow_comments'] ) $a['can_comment'] = 1; 292 293 $this->trellis->skin->set_var( 'a', $a ); 296 294 297 295 $this->nav = array( … … 317 315 #======================================= 318 316 # @ Submit Comment 319 # Adds a new comment to an article. 320 #======================================= 321 322 function do_add_comment() 317 #======================================= 318 319 private function do_add_comment() 323 320 { 324 321 #============================= … … 328 325 $this->trellis->load_functions('articles'); 329 326 330 if ( ! $this->trellis->input['message'] ) $this->view_article( array( 'comment_error' => 'no_message' ));327 if ( ! $this->trellis->input['message'] ) $this->view_article( null, 'no_message' ); 331 328 332 329 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'allow_comments' ), $this->trellis->input['id'] ) ) $this->trellis->skin->error('no_article'); … … 357 354 #======================================= 358 355 # @ Do Search 359 # Performs a search and returns results.360 356 #======================================= 361 357 … … 365 361 # Search! 366 362 #============================= 363 364 # TODO: improve / finish search! 367 365 368 366 $this->trellis->check_token('search'); … … 433 431 #======================================= 434 432 # @ Do Rate 435 # Adding rating to article. 436 #======================================= 437 438 function do_rate() 433 #======================================= 434 435 private function do_rate() 439 436 { 440 437 #============================= … … 442 439 #============================= 443 440 444 $this->trellis->input['id'] = intval( $this->trellis->input['id'] ); 445 $this->trellis->input['amount'] = intval( $this->trellis->input['amount'] ); 446 447 if ( ! $this->trellis->cache->data['settings']['kb']['rating'] ) 448 { 449 $this->trellis->skin->error('kb_rating_disabled'); 450 } 451 452 $this->trellis->db->construct( array( 453 'select' => array( 'id', 'cid', 'title', 'votes', 'rating', 'allow_rating' ), 454 'from' => 'articles', 455 'where' => array( 'id', '=', $this->trellis->input['id'] ), 456 'limit' => array( 0, 1 ), 457 ) ); 458 459 $this->trellis->db->execute(); 460 461 if ( ! $this->trellis->db->get_num_rows() ) 462 { 463 $this->trellis->log( 'error', "Article Not Found ID: ". $this->trellis->input['id'] ); 464 465 $this->trellis->skin->error('no_article'); 466 } 467 468 $a = $this->trellis->db->fetch_row(); 469 470 if ( ! $this->trellis->user['g_kb_rate'] || ! $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_rating'] || ! $a['allow_rating'] ) 471 { 472 $this->trellis->log( 'security', "Blocked Article Rating" ); 473 474 $this->trellis->skin->error('banned_kb_rate'); 475 } 441 $this->trellis->load_functions('articles'); 442 443 if ( ! $a = $this->trellis->func->articles->get_single_by_id( array( 'id', 'cid', 'title', 'rating_total', 'votes', 'allow_rating' ), $this->trellis->input['id'] ) ) $this->trellis->skin->error('no_article'); 476 444 477 445 if ( ! $this->trellis->user['id'] ) … … 491 459 } 492 460 493 $this->trellis->db->construct( array( 494 'select' => 'all', 495 'from' => 'article_rate', 496 'where' => array( array( 'aid', '=', $a['id'] ), array( 'uid', '=', $this->trellis->user['id'], 'and' ) ), 497 'limit' => array( 0, 1 ), 498 ) ); 499 500 $this->trellis->db->execute(); 501 502 if ( $this->trellis->db->get_num_rows() ) 461 if ( ! $this->trellis->cache->data['settings']['kb']['rating'] || ! $this->trellis->user['g_kb_rate'] || ! $this->trellis->cache->data['categories'][ $a['cid'] ]['allow_rating'] || ! $a['allow_rating'] ) $this->trellis->skin->error('no_perm'); # TD LOG no perm 462 463 if ( $this->trellis->func->articles->get_single_rating( array( 'id' ), array( array( 'aid', '=', $a['id'] ), array( 'uid', '=', $this->trellis->user['id'], 'and' ) ) ) ) 503 464 { 504 465 $this->trellis->log( 'security', "Already Rated Article By User '". $a['name'] ."'", 1, $a['id'] ); 505 466 506 $this->trellis->skin->error('already_rated');467 #$this->trellis->skin->error('already_rated'); 507 468 } 508 469 … … 511 472 #============================= 512 473 513 $db_array = array( 514 'aid' => $a['id'], 515 'uid' => $this->trellis->user['id'], 516 'rating' => $this->trellis->input['amount'], 517 'date' => time(), 518 'ipadd' => $this->trellis->input['ip_address'], 519 ); 520 521 $this->trellis->db->construct( array( 522 'insert' => 'article_rate', 523 'set' => $db_array, 524 ) ); 525 526 $this->trellis->db->execute(); 474 $this->trellis->func->articles->add_rating( $this->trellis->input['amount'], $a['id'], array( 'rating_total' => $a['rating_total'], 'votes' => $a['votes'] ) ); 527 475 528 476 $this->trellis->log( 'user', "Article Rating Value ". $this->trellis->input['amount'] ." Added '". $a['name'] ."'", 1, $a['id'] ); 529 530 #=============================531 # Update Article532 #=============================533 534 $new_rating = round( ( $a['rating'] + $this->trellis->input['amount'] ) / ( $a['votes'] + 1 ), 2 );535 536 $this->trellis->db->construct( array(537 'update' => 'articles',538 'set' => array( 'votes' => $a['votes'] + 1, 'rating' => $new_rating ),539 'where' => array( 'id', '=', $a['id'] ),540 'limit' => array( 1 ),541 ) );542 543 $this->trellis->db->next_shutdown();544 $this->trellis->db->execute();545 477 546 478 #============================= … … 548 480 #============================= 549 481 550 $this-> trellis->skin->redirect( '?page=kb&act=view&id='. $a['id'], 'add_rating_success' );482 $this->view_article( 'rating_added' ); 551 483 } 552 484 … … 726 658 function rate_stars($rating, $rate=0, $fid=0) 727 659 { 660 # TODO: move to templates 661 728 662 $half = 0; // Initialize for Security 729 663 … … 734 668 735 669 $real_rating = $rating; 736 737 $rating = round( $rating );738 670 739 671 for ( $x = 1; $x < $rating + 1; $x++ ) … … 743 675 if ( $rate ) 744 676 { 745 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act= rate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_half.gif' alt='". $this->trellis->lang['half_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>";677 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act=dorate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_half.gif' alt='". $this->trellis->lang['half_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>"; 746 678 } 747 679 else … … 754 686 if ( $rate ) 755 687 { 756 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act= rate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_on.gif' alt='". $this->trellis->lang['lang.full_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>";688 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act=dorate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_on.gif' alt='". $this->trellis->lang['lang.full_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>"; 757 689 } 758 690 else … … 767 699 if ( $rate ) 768 700 { 769 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act= rate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_off.gif' alt='". $this->trellis->lang['no_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>";701 $a5_html .= "<a href='". $this->trellis->config['hd_url'] ."/index.php?page=kb&act=dorate&amount=". $x ."&id={$fid}' title='". $x ." ". $this->trellis->lang['stars'] ."'><img src='images/". $this->trellis->skin->data['img_dir'] ."/rate_off.gif' alt='". $this->trellis->lang['no_star'] ."' name='rate". $x ."' style='vertical-align:top' onmouseover='amirate(". $x .")' onmouseout='unamirate(". $real_rating .")' /></a>"; 770 702 } 771 703 else -
trunk/Upload/sources/tickets.php
r73 r74 282 282 $toutput_params = array( 'linkify' => 1 ); 283 283 284 ( $t['html'] ) ? $toutput_params['html'] = 1 : $toutput_params['nl2br'] = 1; 284 if ( $t['html'] ) 285 { 286 $toutput_params['html'] = 1; 287 } 288 else 289 { 290 $toutput_params['paragraphs'] = 1; 291 $toutput_params['nl2br'] = 1; 292 } 285 293 286 294 $t['message'] = $this->trellis->prepare_output( $t['message'], $toutput_params ); … … 341 349 $routput_params = array( 'urls' => 1 ); 342 350 343 ( $r['html'] ) ? $routput_params['html'] = 1 : $routput_params['nl2br'] = 1; 351 if ( $r['html'] ) 352 { 353 $routput_params['html'] = 1; 354 } 355 else 356 { 357 $routput_params['paragraphs'] = 1; 358 $routput_params['nl2br'] = 1; 359 } 344 360 345 361 $replies[ $r['id'] ]['message'] = $this->trellis->prepare_output( $r['message'], $routput_params ); -
trunk/Upload/upgrade/index.php
r37 r74 400 400 @import "../includes/local.css"; 401 401 </style> 402 <script src='../includes/scripts/ global.js' type='text/javascript'></script>402 <script src='../includes/scripts/common.js' type='text/javascript'></script> 403 403 <script src='../includes/scripts/prototype.js' type='text/javascript'></script> 404 404 <script src='../includes/scripts/scriptaculous.js' type='text/javascript'></script>
Note: See TracChangeset
for help on using the changeset viewer.