pixeltrace Posted April 28, 2007 Share Posted April 28, 2007 guys, i need help i dont know what this error means and evenmore, i cannot trace the code to modify to fix this Parse error: parse error, unexpected ';', expecting T_FUNCTION in /var/www/html/memoryworld/administrator/components/com_brandname/admin.brandname.html.php on line 62 this is the code of my page admin.brandname.html.php <? defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); class HTML_BrandName { function showBrandNames( &$rows, &$pageNav, $option ) { global $my; mosCommonHTML::loadOverlib(); ?> <form action="index2.php" method="post" name="adminForm"> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"> <tr> <th width="3" align="center" class="title"> </th> <th width="21" align="center" class="title">#</th> <th width="20" align="center"><span class="title"> <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" /> </span></th> <th width="28" align="center" class="title"> </th> <th width="245" class="title">Brand Name</th> <th width="271" align="center" class="title"> </th> <th width="74" align="center">Published</th> <th width="138" colspan="2">Reorder</th> <th width="38" align="center">ID</th> <th width="84"> </th> </tr> <?php $k = 0; for ($i=0, $n=count($rows); $i < $n; $i++) { $row = $rows[$i]; mosMakeHtmlSafe($row); $link = 'index2.php?option=com_brandname&task=editA&hidemainmenu=1&id='. $row->id; $img = $row->published ? 'tick.png' : 'publish_x.png'; $task = $row->published ? 'unpublish' : 'publish'; $alt = $row->published ? 'Published' : 'Unpublished'; //$checked = mosCommonHTML::CheckedOutProcessing( $row, $i ); //$row->cat_link = 'index2.php?option=com_categories§ion=com_contact_details&task=editA&hidemainmenu=1&id='. $row->catid; //$row->user_link = 'index2.php?option=com_users&task=editA&hidemainmenu=1&id='. $row->user_id; ?> <tr class="<?php echo "row$k"; ?>"> <td width="3" align="center"> </td> <td width="21" align="center"><?php echo $pageNav->rowNumber( $i ); ?></td> <td width="20" align="center"><?php echo $checked; ?></td> <td width="28" align="center"> </td> <td width="245"><a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')"><?php echo $row->name; ?></a></td> <td width="271" align="center"> </td> <td width="74" align="center"><a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="<?php echo $alt; ?>" /></a></td> <td width="69" align="center"><?php echo $pageNav->orderUpIcon( $i, ( $row->id == @$rows[$i-1]->id ) ); ?></td> <td width="69" align="center"><?php echo $pageNav->orderDownIcon( $i, $n, ( $row->id == @$rows[$i+1]->id ) ); ?></td> <td width="38" align="center"><?php echo $row->id; ?></td> <td width="84" align="center"> </td> <?php $k = 1 - $k; } ?> </tr> <?php } ?> </table> <?php echo $pageNav->getListFooter(); ?> <input type="hidden" name="option" value="<?php echo $option; ?>" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="hidemainmenu" value="0"> </form> <? { function editBrandName( &$row, &$lists, $option ) { global $mosConfig_live_site; mosMakeHtmlSafe( $row, ENT_QUOTES ); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // do field validation if ( form.name.value == "" ) { alert( "You must provide a brand name." ); } else { submitform( pressbutton ); } } //--> </script> <form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm"> <table class="adminheading"> <tr> <th> Brand: <small> <?php echo $row->id ? 'Edit' : 'New';?> </small> </th> </tr> </table> <table> <tr> <td align="right">Brand Name : </td> <td><input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo $row->name; ?>" /></td> </tr> <tr> <td align="right">Published : </td> <td><?php echo $lists['published']; ?></td> </tr> <tr> <td align="right">Ordering : </td> <td><?php echo $lists['ordering']; ?></td> </tr> </table> <script language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script> <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> <input type="hidden" name="option" value="<?php echo $option; ?>" /> <input type="hidden" name="task" value="" /> </form> <?php } } ?> and this is the code of the other related page admin.brandname.php <?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); // ensure user has access to this function if (!($acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ) | $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_brandname' ))) { mosRedirect( 'index2.php', _NOT_AUTH ); } require_once( $mainframe->getPath( 'admin_html' ) ); require_once( $mainframe->getPath( 'class' ) ); $cid = josGetArrayInts( 'cid' ); switch ($task) { case 'new': editBrandName( '0', $option); break; case 'edit': editBrandName( intval( $cid[0] ), $option ); break; case 'editA': editBrandName( $id, $option ); break; case 'save': saveBrandName( $option ); break; case 'remove': removeBrandNames( $cid, $option ); break; case 'publish': changeBrandName( $cid, 1, $option ); break; case 'unpublish': changeBrandName( $cid, 0, $option ); break; case 'orderup': orderBrandNames( intval( $cid[0] ), -1, $option ); break; case 'orderdown': orderBrandNames( intval( $cid[0] ), 1, $option ); break; case 'cancel': cancelBrandName(); break; default: showBrandNames( $option ); break; } /** * List the records * @param string The current GET/POST option */ function showBrandNames( $option ) { global $database, $mainframe, $mosConfig_list_limit; $id = intval( $mainframe->getUserStateFromRequest( "id{$option}", 'id', 0 ) ); $limit = intval( $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit ) ); $limitstart = intval( $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 ) ); if ( $id ) { $where[] = "cd.id = " . (int) $id; } if ( isset( $where ) ) { $where = "\n WHERE ". implode( ' AND ', $where ); } else { $where = ''; } // get the total number of records $query = "SELECT COUNT(*)" . "\n FROM #__brandname AS cd" . $where ; $database->setQuery( $query ); $total = $database->loadResult(); require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' ); $pageNav = new mosPageNav( $total, $limitstart, $limit ); // get the subset (based on limits) of required records $query = "SELECT cd.*" . "\n FROM #__brandname AS cd" . $where . "\n ORDER BY cd.id, cd.ordering, cd.name ASC" ; $database->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); $rows = $database->loadObjectList(); // build list of categories //$javascript = 'onchange="document.adminForm.submit();"'; //$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', 'com_contact_details', intval( $catid ), $javascript ); HTML_BrandName::showBrandNames( $rows, $pageNav, $option ); } /** * Creates a new or edits and existing user record * @param int The id of the record, 0 if a new entry * @param string The current GET/POST option */ function editBrandName( $id, $option ) { global $database, $my; global $mosConfig_absolute_path; $row = new mosBrandName( $database ); // load the row from the db table $row->load( (int)$id ); if ($id) { // do stuff for existing records $row->checkout($my->id); } else { // do stuff for new records $row->ordering = 0; $row->published = 1; } $lists = array(); // build the html select list for ordering $query = "SELECT ordering AS value, name AS text" . "\n FROM #__brandname" . "\n WHERE published >= 0" . "\n AND id = " . (int) $row->id . "\n ORDER BY ordering" ; // build list of ordering $lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $id, $query, 1 ); // build the html radio buttons for published $lists['published'] = mosHTML::yesnoradioList( 'published', '', $row->published ); // build the html radio buttons for default $lists['default_con'] = mosHTML::yesnoradioList( 'default_con', '', $row->default_con ); HTML_BrandName::editBrandName( $row, $lists, $option ); } /** * Saves the record from an edit form submit * @param string The current GET/POST option */ function saveBrandName( $option ) { global $database; $row = new mosBrandName( $database ); if (!$row->bind( $_POST )) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } // pre-save checks if (!$row->check()) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } // save the changes if (!$row->store()) { echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; exit(); } $row->checkin(); $row->updateOrder(); if ($row->default_con) { $query = "UPDATE #__brandname" . "\n SET default_con = 0" . "\n WHERE id != " . (int) $row->id . "\n AND default_con = 1" ; $database->setQuery( $query ); $database->query(); } mosRedirect( "index2.php?option=$option" ); } /** * Removes records * @param array An array of id keys to remove * @param string The current GET/POST option */ function removeBrandNames( &$cid, $option ) { global $database; if (count( $cid )) { mosArrayToInts( $cid ); $cids = 'id=' . implode( ' OR id=', $cid ); $query = "DELETE FROM #__brandname" . "\n WHERE ( $cids )" ; $database->setQuery( $query ); if (!$database->query()) { echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; } } mosRedirect( "index2.php?option=$option" ); } /** * Changes the state of one or more content pages * @param array An array of unique category id numbers * @param integer 0 if unpublishing, 1 if publishing * @param string The current option */ function changeBrandName( $cid=null, $state=0, $option ) { global $database, $my; if (!is_array( $cid ) || count( $cid ) < 1) { $action = $publish ? 'publish' : 'unpublish'; echo "<script> alert('Select an item to $action'); window.history.go(-1);</script>\n"; exit(); } mosArrayToInts( $cid ); $cids = 'id=' . implode( ' OR id=', $cid ); $query = "UPDATE #__brandname" . "\n SET published = " . (int) $state . "\n WHERE ( $cids )" //. "\n AND ( checked_out = 0 OR ( checked_out = " . (int) $my->id . ") )" ; $database->setQuery( $query ); if (!$database->query()) { echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; exit(); } if (count( $cid ) == 1) { $row = new mosBrandName( $database ); $row->checkin( intval( $cid[0] ) ); } mosRedirect( "index2.php?option=$option" ); } /** JJC * Moves the order of a record * @param integer The increment to reorder by */ function orderBrandNames( $uid, $inc, $option ) { global $database; $row = new mosBrandName( $database ); $row->load( (int)$uid ); $row->updateOrder(); $row->move( $inc, "published >= 0" ); $row->updateOrder(); mosRedirect( "index2.php?option=$option" ); } /** PT * Cancels editing and checks in the record */ function cancelBrandName() { global $database; $row = new mosBrandName( $database ); $row->bind( $_POST ); $row->checkin(); mosRedirect('index2.php?option=com_brandname'); } ?> hope you could help me with this. thanks so much! Link to comment https://forums.phpfreaks.com/topic/49053-help-on-my-php-error/ Share on other sites More sharing options...
Silverado_NL Posted April 28, 2007 Share Posted April 28, 2007 you have no closing bracket for this class class HTML_BrandName { and what are you trying to do here??? <? { function editBrandName( &$row, &$lists, $option ) { global $mosConfig_live_site; mosMakeHtmlSafe( $row, ENT_QUOTES ); ?> <script language="javascript" type="text/javascript"> <!-- The opening bracket on line 71 isnt making any sence to me code editor application like JEdit gives a good overview of all the bracket used in a script Link to comment https://forums.phpfreaks.com/topic/49053-help-on-my-php-error/#findComment-240341 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.