function insert_new_entry()
 {
     global $IN, $FNS, $OUT, $LANG, $SESS, $LOC, $EXT, $PREFS;
     $LANG->fetch_language_file('weblog');
     $LANG->fetch_language_file('publish');
     // Ya gotta be logged-in billy bob...
     if ($SESS->userdata('member_id') == 0) {
         return $OUT->show_user_error('general', $LANG->line('weblog_must_be_logged_in'));
     }
     /** ----------------------------------------
     		/**  Prep data for insertion
     		/** ----------------------------------------*/
     if (!$IN->GBL('preview', 'POST')) {
         unset($_POST['hidden_pings']);
         unset($_POST['status_id']);
         unset($_POST['allow_cmts']);
         unset($_POST['allow_tbks']);
         unset($_POST['sticky_entry']);
         if (!$IN->GBL('entry_date', 'POST')) {
             $_POST['entry_date'] = $LOC->set_human_time($LOC->now);
         }
         if (!class_exists('Display')) {
             require PATH_CP . 'cp.display' . EXT;
         }
         global $DSP;
         $DSP = new Display();
         // -------------------------------------------
         // 'weblog_standalone_insert_entry' hook.
         //  - Modify any of the POST data for a stand alone entry insert
         //
         $edata = $EXT->call_extension('weblog_standalone_insert_entry');
         if ($EXT->end_script === TRUE) {
             return;
         }
         //
         // -------------------------------------------
         if (!class_exists('Publish')) {
             require PATH_CP . 'cp.publish' . EXT;
         }
         $PB = new Publish();
         $PB->assign_cat_parent = $PREFS->ini('auto_assign_cat_parents') == 'n' ? FALSE : TRUE;
         return $PB->submit_new_entry(FALSE);
     }
     // END Insert
     /** ----------------------------------------
     		/**  Preview Entry
     		/** ----------------------------------------*/
     if ($IN->GBL('PRV', 'POST') == '') {
         $LANG->fetch_language_file('weblog');
         return $OUT->show_user_error('general', $LANG->line('weblog_no_preview_template'));
     }
     $FNS->clear_caching('all', $_POST['PRV']);
     // -------------------------------------------
     // 'weblog_standalone_preview_entry' hook.
     //  - Modify any of the POST data for a stand alone entry preview
     //
     $edata = $EXT->call_extension('weblog_standalone_preview_entry');
     if ($EXT->end_script === TRUE) {
         return;
     }
     //
     // -------------------------------------------
     require PATH_CORE . 'core.template' . EXT;
     global $TMPL;
     $TMPL = new Template();
     $preview = !$IN->GBL('PRV', 'POST') ? '' : $IN->GBL('PRV');
     if (strpos($preview, '/') === FALSE) {
         return FALSE;
     }
     $ex = explode("/", $preview);
     if (count($ex) != 2) {
         return FALSE;
     }
     $TMPL->run_template_engine($ex['0'], $ex['1']);
 }
 private function _new_follower_email($leader_id, $follower_id, $template)
 {
     global $DB, $REGX, $PREFS, $FNS, $LANG;
     //get leader information
     $query = $DB->query("SELECT * FROM exp_members, exp_member_data\n\t\t\t\t\t\t\t WHERE exp_members.member_id = exp_member_data.member_id\n\t\t\t\t\t\t\t AND exp_members.member_id = '" . $leader_id . "'\n\t\t\t\t\t\t\t AND accept_messages = 'y'");
     $leaderInfo = $query->result[0];
     //get follower information
     $query = $DB->query("SELECT * FROM exp_members, exp_member_data\n\t\t\t\t\t\t\t WHERE exp_members.member_id = exp_member_data.member_id\n\t\t\t\t\t\t\t AND exp_members.member_id = '" . $follower_id . "'");
     $followerInfo = $query->result[0];
     //get template information
     list($template_group, $template_name) = split(SLASH, $template);
     $sql = "SELECT g.group_name, t.template_name, t.template_data \n\t\t\t\tFROM exp_templates t \n\t\t\t\tLEFT JOIN exp_template_groups g ON t.group_id = g.group_id \n\t\t\t\tWHERE t.template_name='" . $template_name . "' \n\t\t\t\tAND g.group_name='" . $template_group . "'\n\t\t\t\tLIMIT 1";
     $query = $DB->query($sql);
     $templateInfo = $query->result[0];
     //get template
     $TMPL = new Template();
     $TMPL->run_template_engine($query->row['group_name'], $query->row['template_name']);
     $messagebody = $TMPL->final_template;
     //get subject
     $bodyArray = split("\n", $messagebody);
     $subject = $LANG->line('followers_subject');
     if (substr($bodyArray[0], 0, 9) == "Subject: ") {
         $subject = substr($bodyArray[0], 9);
         unset($bodyArray[0]);
     }
     $messagebody = join("\n", $bodyArray);
     //get swap data
     $swap['leader_name'] = $leaderInfo['m_field_id_37'] . ' ' . $leaderInfo['m_field_id_38'];
     $swap['follower_name'] = $followerInfo['m_field_id_37'] . ' ' . $followerInfo['m_field_id_38'];
     $swap['follower_id'] = $followerInfo['member_id'];
     $swap['leader_id'] = $leaderInfo['member_id'];
     //get conditionals
     $cond['following_and_followed'] = $this->_check_if_mutual($leaderInfo['member_id'], $this->_get_member_id());
     //perform swaps
     $messagebody = $FNS->var_swap($messagebody, $swap);
     $messagebody = $FNS->prep_conditionals($messagebody, $cond);
     $subject = $FNS->var_swap($subject, $swap);
     $subject = $FNS->prep_conditionals($subject, $cond);
     if (!empty($leaderInfo)) {
         if (!class_exists('EEmail')) {
             require PATH_CORE . 'core.email' . EXT;
         }
         $email = new EEmail();
         if (!class_exists('Typography')) {
             require PATH_CORE . 'core.typography' . EXT;
         }
         $TYPE = new Typography(0);
         $messagebody = $TYPE->parse_type(stripslashes($REGX->xss_clean($messagebody)), array('text_format' => 'none', 'html_format' => 'none', 'auto_links' => 'n', 'allow_img_url' => 'n'));
         foreach ($query->result as $row) {
             $email->initialize();
             $email->from($PREFS->ini('webmaster_email'), $PREFS->ini('webmaster_name'));
             $email->to($leaderInfo['email']);
             $email->subject($subject);
             $email->message($REGX->entities_to_ascii($messagebody));
             $email->Send();
             // cc to private messaging table
             $this->_cc_private_messaging(NULL, $leaderInfo['member_id'], $subject, $messagebody);
             //
         }
     }
 }
Example #3
0
 /** ----------------------------------------
     /**  Preview handler
     /** ----------------------------------------*/
 function preview_handler()
 {
     global $IN, $OUT, $LANG, $FNS, $REGX;
     if ($IN->GBL('PRV', 'POST') == '') {
         $error[] = $LANG->line('cmt_no_preview_template_specified');
         return $OUT->show_user_error('general', $error);
     }
     if (!isset($_POST['PRV']) or $_POST['PRV'] == '') {
         exit('Preview template not specified in your comment form tag');
     }
     $_POST['PRV'] = $REGX->trim_slashes($REGX->xss_clean($_POST['PRV']));
     $FNS->clear_caching('all', $_POST['PRV']);
     $FNS->clear_caching('all', $_POST['RET']);
     require PATH_CORE . 'core.template' . EXT;
     global $TMPL;
     $TMPL = new Template();
     $preview = !$IN->GBL('PRV', 'POST') ? '' : $IN->GBL('PRV');
     if (strpos($preview, '/') === FALSE) {
         $preview = '';
     } else {
         $ex = explode("/", $preview);
         if (count($ex) != 2) {
             $preview = '';
         }
     }
     if ($preview == '') {
         $group = 'weblog';
         $templ = 'preview';
     } else {
         $group = $ex['0'];
         $templ = $ex['1'];
     }
     $TMPL->run_template_engine($group, $templ);
 }
Example #4
0
                     $IN->Pages_QSTR = $entry_id;
                 }
             }
         }
         require PATH_CORE . 'core.template' . EXT;
         $TMPL = new Template();
         // Templates and Template Groups can be hard-coded
         // within either the main triggering file or via an include.
         if (!isset($template_group)) {
             $template_group = '';
         }
         if (!isset($template)) {
             $template = '';
         }
         // Parse the template
         $TMPL->run_template_engine($template_group, $template);
     }
     break;
     /** ---------------------------
     	/**  Control Panel Requests
     	/** ---------------------------*/
 /** ---------------------------
 	/**  Control Panel Requests
 	/** ---------------------------*/
 case 'CP':
     /** ------------------------------------
         /**  Define our base URL
         /** ------------------------------------*/
     $s = $PREFS->ini('admin_session_type') != 'c' ? $SESS->userdata('session_id') : 0;
     define('BASE', SELF . '?S=' . $s);
     /** ------------------------------------