Phpcoin V122 Full 2005 09 26 > Coin Modules / Articles / Articles Admin.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Phpcoin V122 Full 2005 09 26

Download:
phpcoin-v122-full-2005-09-26.zip

Category:
Web Hosting Tools

Archive Content:

Content:

Coin Auxpages

Coin Cron

Coin Database

Coin Docs

Coin Images

Coin Includes

Coin Lang > Lang English

Coin Modules > Articles

Coin Modules > Cc

Coin Modules > Clients

Coin Modules > Domains

Coin Modules > Downloads

Coin Modules > Faq

Coin Modules > Helpdesk

Coin Modules > Invoices

Coin Modules > Mail

Coin Modules > Orders

Coin Modules > Pages

Coin Modules > Search

Coin Modules > Siteinfo

Coin Modules > Whois

Coin Setup

Coin Setup > Sql

Coin Setup

Coin Themes > Cantex

Coin Themes > Cantex > Html

Coin Themes > Cantex > Images

Coin Themes > Cantex > Images > Nav

Coin Themes > Cantex > Images

Coin Themes > Cantex

Coin Themes > Classic

Coin Themes > Classic > Html

Coin Themes > Classic > Images

Coin Themes > Classic > Images > Nav

Coin Themes > Classic

Coin Themes > Coolblue

Coin Themes > Coolblue > Html

Coin Themes > Coolblue > Images

Coin Themes > Coolblue > Images > Nav

Coin Themes > Coolblue

Coin Themes > Earthtone

Coin Themes > Earthtone > Html

Coin Themes > Earthtone > Images > Nav

Coin Themes > Earthtone > Images

Coin Themes > Earthtone

Content:

Coin Admin

Articles Admin.php:


<?php

/**************************************************************
 * File:         Articles Module Admin Functions File
 * Author:    Mike Lansberry (http://phpcoin.com)
 * Date:        2004-01-04 (V1.2.0)
 * Changed:     Stephen M. Kitching,  2005-03-08 (v1.2.2)
 * License:    DO NOT Remove this text block. See /coin_docs/license.txt
 *            Copyright © 2003-2004-2005 phpCOIN.com
 * Schema:    See sql file for schema reference
 * Notes:
 *    - Translation File: lang_articles.php
 *
**************************************************************/
# Code to handle file being loaded by URL
    
IF (!isset($_SERVER))    { $_SERVER $HTTP_SERVER_VARS; }
    IF (
eregi("articles_admin.php",  $_SERVER["PHP_SELF"]))
        {
            require_once (
'../../coin_includes/session_set.php');
            require_once (
$_CCFG['_PKG_PATH_INCL'].'redirect.php');
            
html_header_location('error.php?err=01&url=mod.php?mod=articles');
            exit;
        }

/**************************************************************
 * Module Admin Functions
**************************************************************/
# Do Form for Add / Edit
function do_form_add_edit ($amode,  $adata,  $aerr_entry,  $aret_flag=)
    {
        
# Get security vars
            
$_SEC get_security_flags ();

        
# Dim some Vars:
            
global $_CCFG,  $_TCFG,  $_DBCFG,  $_UVAR,  $_LANG,  $_SERVER,  $_nl,  $_sp;
            
$query ""$result""$numrows 0;

        
# Build mode dependent strings
            
switch ($amode)
            {
                case 
"add":
                    
$mode_proper    $_LANG['_ARTICLES']['B_Add'];
                    
$mode_button    $_LANG['_ARTICLES']['B_Add'];
                    break;
                case 
"edit":
                    
$mode_proper    $_LANG['_ARTICLES']['B_Edit'];
                    
$mode_button    $_LANG['_ARTICLES']['B_Save'];
                    break;
                default:
                    
$amode            "add";
                    
$mode_proper    $_LANG['_ARTICLES']['B_Add'];
                    
$mode_button    $_LANG['_ARTICLES']['B_Add'];
                    break;
            }

        
# Build Title String,  Content String,  and Footer Menu String
            
$_tstr .= $mode_proper.$_sp.$_LANG['_ARTICLES']['Articles_Entry'].$_sp.'('.$_LANG['_ARTICLES']['all_fields_required'].')';

        
# Do data entry error string check and build
            
IF ($aerr_entry['flag'])
            {
                 
$err_str $_LANG['_ARTICLES']['ART_ERR_ERR_HDR1'].'<br>'.$_LANG['_ARTICLES']['ART_ERR_ERR_HDR2'].'<br>'.$_nl;

                 IF (
$aerr_entry['subject'])     { $err_str .= $_LANG['_ARTICLES']['ART_ERR_ERR01']; $err_prv 1; }
                IF (
$aerr_entry['topic_id'])     { IF ($err_prv) { $err_str .= ',  '; } $err_str .= $_LANG['_ARTICLES']['ART_ERR_ERR02']; $err_prv 1; }
                IF (
$aerr_entry['cat_id'])         { IF ($err_prv) { $err_str .= ',  '; } $err_str .= $_LANG['_ARTICLES']['ART_ERR_ERR03']; $err_prv 1; }
                IF (
$aerr_entry['entry'])         { IF ($err_prv) { $err_str .= ',  '; } $err_str .= $_LANG['_ARTICLES']['ART_ERR_ERR04']; $err_prv 1; }

                  
$_cstr .= '<p align="center"><b>'.$err_str.'</b>'.$_nl;
            }

        
# Build common td start tag / col strings (reduce text)
            
$_td_str_left            '<td class="TP1SML_NR" width="25%">';
            
$_td_str_left_valign    '<td class="TP1SML_NR" width="25%" valign="top">';
            
$_td_str_right            '<td class="TP1SML_NL" width="75%">';
            
$_td_str_right_just        '<td class="TP1SML_NJ" width="75%">';

        
# Do Main Form
            
$_cstr .= '<FORM METHOD="POST" ACTION="'.$_SERVER["PHP_SELF"].'?mod=articles&mode='.$amode.'">'.$_nl;
            
$_cstr .= '<table cellpadding="5" width="100%">'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_LANG['_ARTICLES']['l_Article_ID'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            IF ( 
$adata['mode'] == 'add' )
                { 
$_cstr .= '('.$_LANG['_ARTICLES']['auto-assigned'].')'.$_nl; }
            ELSE
                { 
$_cstr .= $adata[id].$_nl; }
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;

            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left_valign.'<b>'.$_LANG['_ARTICLES']['l_DateTime'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            IF ( 
$adata[time_stamp] <= || $adata[time_stamp] == '') { $adata[time_stamp] = dt_get_uts().$_nl; }
            
$_cstr .= do_datetime_edit_list (time_stamp,  $adata[time_stamp],  1).$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;

            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_LANG['_ARTICLES']['l_Subject'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            
$_cstr .= '<INPUT class="PSML_NL" TYPE=TEXT NAME="subject" SIZE=50 value="'.$adata[subject].'">'.$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_LANG['_ARTICLES']['l_Topic'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            
# Call select list function
                
$aname    "topic_id";
                
$avalue    $adata[topic_id];
                
$_cstr .= do_select_list_topic($aname,  $avalue,  '1').$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_LANG['_ARTICLES']['l_Category'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            
# Call select list function
                
$aname    "cat_id";
                
$avalue    $adata[cat_id];
                
$_cstr .= do_select_list_cat($aname,  $avalue,  '1').$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
                IF ( 
$adata[auto_nl2br] == '' )    { $adata[auto_nl2br] = 1; }
                IF ( 
$adata[auto_nl2br] == )    { $_set ' CHECKED'; } ELSE { $_set ''$adata[auto_nl2br] = 0; }
            
$_cstr .= '<INPUT TYPE=CHECKBOX NAME="auto_nl2br" value="1"'.$_set.' border="0">'.$_nl;
            
$_cstr .= $_sp.'<b>'.$_LANG['_ARTICLES']['Convert_New_Line_2_Break'].'</b>'.$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left_valign.'<b>'.$_LANG['_ARTICLES']['l_Entry'].$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right_just.$_nl;
            
$_cstr .= '<TEXTAREA class="PSML_NL" NAME="entry" COLS=60 ROWS=25>'.do_stripslashes($adata[entry]).'</TEXTAREA>'.$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= '<td class="TP0SML_NC" width="100%" colspan="2">'.$_nl;
            
$_cstr .= '<INPUT TYPE=hidden name="stage" value="1">'.$_nl;
            
$_cstr .= '<INPUT TYPE=hidden name="id" value="'.$adata[id].'">'.$_nl;
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '<tr>'.$_nl;
            
$_cstr .= $_td_str_left.'<b>'.$_sp.'</b></td>'.$_nl;
            
$_cstr .= $_td_str_right.$_nl;
            
$_cstr .= do_input_button_class_sw ('b_edit',  'SUBMIT',  $mode_button,  'button_form_h',  'button_form',  '1').$_nl;
            
$_cstr .= do_input_button_class_sw ('b_reset',  'RESET',  $_LANG['_ARTICLES']['B_Reset'],  'button_form_h',  'button_form',  '1').$_nl;
            IF (
$adata['mode']=="edit")
                { 
$_cstr .= do_input_button_class_sw ('b_delete',  'SUBMIT',  $_LANG['_ARTICLES']['B_Delete_Entry'],  'button_form_h',  'button_form',  '1').$_nl; }
            
$_cstr .= '</td>'.$_nl;
            
$_cstr .= '</tr>'.$_nl;
            
$_cstr .= '</table>'.$_nl;
            
$_cstr .= '</FORM>'.$_nl;

            
$_mstr .= do_nav_link ('admin.php',  $_TCFG['_IMG_ADMIN_M'], $_TCFG['_IMG_ADMIN_M_MO'], '', '');
            
$_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mod=articles&mode=edit&id='.$adata[id],  $_TCFG['_IMG_EDIT_M'], $_TCFG['_IMG_EDIT_M_MO'], '', '');
            
$_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mod=articles&mode=add',  $_TCFG['_IMG_ADD_NEW_M'], $_TCFG['_IMG_ADD_NEW_M_MO'], '', '');
            
$_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mod=articles&mode=summary',  $_TCFG['_IMG_SUMMARY_M'], $_TCFG['_IMG_SUMMARY_M_MO'], '', '');
            
$_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mod=articles',  $_TCFG['_IMG_LISTING_M'], $_TCFG['_IMG_LISTING_M_MO'], '', '');

        
# Call block it function
            
$_out .= do_mod_block_it ($_tstr,  $_cstr,  '1',  $_mstr,  '1');
            
$_out .= '<br>'.$_nl;

        IF ( 
$aret_flag ) { return $_out; } ELSE { echo $_out; }
    }

/**************************************************************
 * End Module Admin Functions
**************************************************************/

?>



Other Web Hosting Tools Scripts:

WebMaster Resources Home

©RingsWorld.com