JA Submit - direct to front page? - Joomla! Forum - community, help and support
is there way can allow ja submit approve articles front page?
not without small hack. doing tomorrow. checkbox "show on frontpage". i'll edit post.
okay in ja_submit_html.php:
and in ja submit.php replace submit form this:
okay in ja_submit_html.php:
code: select all
<td width="42%" rowspan="3" align="right">
<?php
// toolbar top
mostoolbar::starttable();
mostoolbar::save();
mostoolbar::cancel();
mostoolbar::endtable();
?>
</td></tr>
<tr>
//=========a=d=d===t=h=i=s===============================
`<td><label for="show_on_front page">show on frontpage</label>:</td>
<td><input class="checkbox" type="checkbox" name="frontpage" value="1" ></td>
//================================================
</tr>
<tr>
<td><label for="created_by_alias"><?php echo _h_fullname; ?>*</label>:</td>and in ja submit.php replace submit form this:
code: select all
function submit_save_form() {
global $database, $mainframe, $my,
$mosconfig_live_site, $mosconfig_absolute_path,$itemid,
$h_notify_email, $h_catid, $h_sectionid,$mosconfig_mailfrom,$mosconfig_sitename;
require ($mosconfig_absolute_path.'/administrator/components/com_ja_submit/settings.php');
# security image www.waltercedric.com
if ($h_securityimage) {
$checksecurity = true;
$security_refid = mosgetparam( $_post, 'security_refid', '' );
$security_try = mosgetparam( $_post, 'security_try', '' );
include ($mosconfig_absolute_path.'/administrator/components/com_securityimages/server.php');
$checksecurity &= checksecurityimage($security_refid, $security_try);
if (!$checksecurity) {
mosredirect( "index.php?option=com_ja_submit",_h_si_refuse );
}
}
# security image www.waltercedric.com
//start uploading introtext image , maintext image
//$allow_extendsions=array('jpg','gif','png');
if (!image_upload()){
mosredirect( "index.php?option=com_ja_submit",_h_unable_image );
}
//finish uploading images, start uploading content database
$nulldate = $database->getnulldate();
$row = new moscontent( $database );
if ( !$row->bind( $_post ) ) {
echo "<script> alert('".$row->geterror()."'); window.history.go(-1); </script>\n";
exit();
}
$query="select section
from #__categories
where id=".$row->catid;
$database->setquery($query);
$row->sectionid=$database->loadresult();
#build sql string
//introtext image
$nameimage1 = $_files['image1']['name'];
$nameimage2 = $_files['image2']['name'];
if ($_post['caption1'] != '') {
$row->images="users/".$nameimage1."|right||1|".$_post['caption1']."|bottom||";
} else
{
$row->images="users/".$nameimage1."|right||1||";
}
$addmos = "{mosimage}";
if ($nameimage1!=""){
$row->introtext=$addmos.$row->introtext;
}
//main text image
if ($_post['caption2'] != '') {
$row->images.="\n"."users/".$nameimage2."|left||1|".$caption2."|bottom||";
} else
{
$row->images.="\n"."users/".$nameimage2."|left||1||";
}
if ($nameimage2!=""){
$row->fulltext=$addmos.$row->fulltext;
}
// new record
$row->created = date( 'y-m-d h:i:s' );
$row->created_by = $my->id;
if ( trim( $row->publish_down ) == 'never' ) {
$row->publish_down = $nulldate;
}
// code cleaner xhtml transitional compliance
$row->introtext = str_replace( '<br>', '<br />', $row->introtext );
$row->fulltext = str_replace( '<br>', '<br />', $row->fulltext );
// remove <br /> take being automatically added empty fulltext
$length = strlen( $row->fulltext ) < 9;
$search = strstr( $row->fulltext, '<br />');
if ( $length && $search ) {
$row->fulltext = null;
}
$row->title = ampreplace( $row->title );
if(stristr($my->usertype, 'head student') ){
// gets parent_id of head student. report to.
$query = "select parent_id"
. "\n #__core_acl_aro_groups"
. "\n group_id = '$my->gid'"
;
$database->setquery( $query );
// gets category name of item
$accesslvl = $database->loadresult();
$row->access = $accesslvl->parent_id;
}elseif( $my->usertype == 'administrator' || $my->usertype == 'super administrator') {
// gets section name of item
$query = "select access"
. "\n #__categories"
. "\n id = '$row->catid'"
;
$database->setquery( $query );
$accessgroup = $database->loadresult();
$row->access = intval($accessgroup);
}
// auto publish well
$row->state = 1;
if (!$row->check()) {
echo "<script> alert('".$row->geterror()."'); window.history.go(-1); </script>\n";
exit();
}
$row->version++;
if (!$row->store()) {
echo "<script> alert('".$row->geterror()."'); window.history.go(-1); </script>\n";
exit();
}
// manage frontpage items
require_once( $mainframe->getpath( 'class', 'com_frontpage' ) );
$fp = new mosfrontpage( $database );
//====================== hack right here
// can fill in catid's autopublish too.
//if (($row->catid == 000 ) || ($row->catid == 000 ) || ( mosgetparam( $_request, 'frontpage', 0 ) )){
if ( mosgetparam( $_request, 'frontpage', 0 )){
$sof=1;
}
if ($sof==1){
// toggles go first place
if (!$fp->load( $row->id )) {
// new entry
$query = "insert #__content_frontpage"
. "\n values ( $row->id, 1 )"
;
$database->setquery( $query );
if (!$database->query()) {
echo "<script> alert('".$database->stderr()."');</script>\n";
exit();
}
$fp->ordering = 1;
}
} else {
// no frontpage mask
if ( !$fp->delete( $row->id ) ) {
$msg .= $fp->stderr();
}
$fp->ordering = 0;
}
$fp->updateorder();
$row->checkin();
$row->updateorder( "catid = $row->catid" );
// gets section name of item
$query = "select s.title"
. "\n #__sections s"
. "\n s.scope = 'content'"
. "\n , s.id = $row->sectionid"
;
$database->setquery( $query );
// gets category name of item
$section = $database->loadresult();
$query = "select c.title"
. "\n #__categories c"
. "\n c.id = $row->catid"
;
$database->setquery( $query );
$category = $database->loadresult();
//sending emails
// todo add email cb profiles belong group....
// way people notified of everything....
$message=_h_email_notice;
$message.=".$mosconfig_sitename.";
$message.=_h_as_follow."\n"."\n";
$message.="======================================================================="."\n"."\n";
$message.=_h_name.": ".$_post['created_by_alias']."\n";
$message.=_h_email.": ".$_post['email']."\n";
$message.=_h_title.": ".$_post['title']."\n";
$message.=_h_section.": ".$section."\n";
$message.=_h_cat.": ".$category."\n"."\n";
$message.=_h_introtext.": ".$_post['introtext']."\n"."\n";
$message.=_h_maintext.": ".$_post['fulltext']."\n"."\n";
$message.=_h_pls_log_pr."\n"."\n";
$message.=_h_autosystem."\n"."\n";
$headers = "from: ".$mosconfig_mailfrom."\r\n" .
'reply-to: '.$mosconfig_mailfrom."\r\n";
$subject=_h_email_subject;
if (trim($h_notify_email)!="")
{
$listemails=explode(";",$h_notify_email);
sendmail($listemails,$subject,$message,$headers);
}
/*
//send message let administrators know new item has been uploaded
// messaging new items
require_once( $mosconfig_absolute_path .'/components/com_messages/messages.class.php' );
$query = "select id"
. "\n #__users"
. "\n sendemail = 1"
;
$database->setquery( $query );
$users = $database->loadresultarray();
foreach ($users $user_id) {
$msg = new mosmessage( $database );
$msg->send( $my->id, $user_id, "new item", sprintf( _on_new_content, $my->username, $row->title, $section, $category ) );
}*/
if ($row->state==1){
$phrase="1";//_h_thanks_published
$query="select id #__content order id desc limit 0,1";
$database->setquery($query);
$row=$database->loadrow();
$phrase.="&id=".$row[0];
}
else{
$phrase="2";//_h_thanks
}
mosredirect( "index.php?option=com_ja_submit&task=great&phrase=$phrase","" );
}
Comments
Post a Comment