Beispiel #1
0
} elseif (isset($_POST['submit_lp'])) {
    insert_lp($id);
} elseif (isset($_POST['submit_video'])) {
    insert_video($id);
} elseif (isset($_POST['submit_exercise'])) {
    insert_exercise($id);
} elseif (isset($_POST['submit_work'])) {
    insert_work($id);
} elseif (isset($_POST['submit_forum'])) {
    insert_forum($id);
} elseif (isset($_POST['submit_poll'])) {
    insert_poll($id);
} elseif (isset($_POST['submit_wiki'])) {
    insert_wiki($id);
} elseif (isset($_POST['submit_link'])) {
    insert_link($id);
} elseif (isset($_POST['submit_ebook'])) {
    insert_ebook($id);
}


switch ($_GET['type']) {
    case 'work': $pageName = "$langAdd $langInsertWork";
        include 'insert_work.php';
        list_assignments();
        break;
    case 'doc': $pageName = "$langAdd $langInsertDoc";
        include 'insert_doc.php';
        list_docs();
        break;
    case 'exercise': $pageName = "$langAdd $langInsertExercise";
Beispiel #2
0
	/** Generation de l'email a envoyer pour un destinataire
	 * @param Array _tzData Donnees de l'email
	 */
	function generateAndSend ($_tzData) {
		global $giNbSent;
		$zStr = 'pj';
		$arr_pj = explode ("|", $_tzData[$zStr]);

		$zStr = 'destinataire';
		$liste_email = $_tzData[$zStr];
		if (!is_email($liste_email)) {
			$liste_email = get_liste_email($liste_email,$_tzData['type_envoi']);
		}

		$zStr = 'nom';
		$zStr1 = 'expediteur';
		$zStr2 = 'id';

		$tzEmail = explode (",", $liste_email);
		print "\n\n------------------- INSERT INTO TABLE envoi " . $_tzData[$zStr2] . " -------------------------\n";
		print_r ($tzEmail);
		foreach ($tzEmail AS $iIndex => $zEmail) {
		//-- Ne plas sauvegarder les emails déjà sauvegardé
			$zQuery = "SELECT etat FROM envoi WHERE id_envoi = " . $_tzData[$zStr2] . " AND email = '" . $zEmail . "'";
			if ($tiCount = mysql_fetch_assoc (mysql_query ($zQuery))) {
				if ($tiCount['etat'] == 1) {
					unset ($tzEmail[$iIndex]);
				}
				continue;
			}
		//-- Sauvegarder en base les adresses email à envoyer de l'envoi
			$zQuery = "INSERT INTO envoi (id_envoi, email, etat) VALUES (" . $_tzData[$zStr2] . ", '" . $zEmail . "', 0)";
			mysql_query ($zQuery);
		}
		
		print "\n\n------------------- SEND EMAILS " . $_tzData[$zStr2] . " -------------------------\n";
		print_r ($tzEmail);
		$str_repl = 1;

		$zStr_txt = 'text';
		$zStr_id = 'id';
		$text_init = $_tzData[$zStr_txt];		// Le corps du message initial
			
		foreach ($tzEmail AS $zEmail) {

			// Traitement du lien si le client clique dessus
			$text = str_replace('href="','href="' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $_tzData[$zStr_id] . '&m=' . $zEmail . '&u=', $text_init);
			if($text == $text_init){
				$text = str_replace('href=\"','href=\"' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $_tzData[$zStr_id] . '&m=' . $zEmail . '&u=', $text_init);
			}
			

			$text .= '<p style="text-align: center;"><a href="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'">Visualiser cette email comme page HTML</a></p>';
			$text .= '<img src="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'" style="width:1px; height:1px;" frameborder="0" />';
//			$text .= '<iframe src="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'" style="width:1px; height:1px; display: none; width: 1px;" />';
	
			$text .= insert_link($_tzData[$zStr_id]);
      $body = CNmail::build_html_body('', stripslashes($text));
      
      if(!CMail::send_mailing($zEmail, $_tzData[$zStr], $body, $_tzData[$zStr1], $arr_pj)) {
        // $msginfo = "Echec d'envoi d'email. Veuillez r&eacute;essayer ult&eacute;rieurement";
        break;
      }

		//-- Marquer l'email comme envoye a l'adresse
			$zQuery = "UPDATE envoi SET etat = 1 WHERE id_envoi = " . $_tzData[$zStr2] . " AND email = '" . $zEmail . "'";
			mysql_query ($zQuery);
			$giNbSent ++;
			if ($giNbSent == ENVOI_NB_EMAILS_MAXI) {
				break;
			}
		}
	}
Beispiel #3
0
                 $stmt = $pdo->prepare($sql);
                 $stmt->bindParam(':language', $language);
                 $stmt->bindParam(':country', $country);
                 $stmt->bindParam(':continent', $continent);
                 $stmt->bindParam(':request', $new_url);
                 $stmt->execute();
                 $row = $stmt->fetch(PDO::FETCH_OBJ);
                 if (!empty($row)) {
                     if (strtolower($row->url) != strtolower($original)) {
                         insert_link($pdo, $language, $country, $continent, $request, $id, $new_content, $new_url, $original);
                     } else {
                         $json->status = 'ERROR';
                         $json->message = 'Can not override existing link';
                     }
                 } else {
                     insert_link($pdo, $language, $country, $continent, $request, $id, $new_content, $new_url, $original);
                 }
             }
         } else {
             $json->status = 'ERROR';
             $json->message = 'Invalid session';
         }
     }
 } catch (PDOException $e) {
     error_log(__FILE__ . ' : ' . $e->getMessage());
     $json->status = 'ERROR';
     $json->message = 'PDOException: ' . $e->getMessage();
 } catch (MemcacheException $e) {
     error_log(__FILE__ . ' : ' . $e->getMessage());
     $json->status = 'ERROR';
     $json->message = 'MEMCACHEException: ' . $e->getMessage();
							<a href="' . $_SERVER["PHP_SELF"] . '?page_name=links&amp;action=delete&amp;link_id=' . $link['id'] . '">
							delete</a>
						</div>
						
					</li>
				';
        }
        $looped_cat = $cat;
    }
    $html .= '</ul>';
    return $html;
}
// process post actions
// insert a link
if (isset($_POST['insert_link']) && $_POST['insert_link'] == 'add') {
    $insert_status = insert_link();
    if (is_int($insert_status)) {
        header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=links&link_id=' . $insert_status);
    } else {
        $error = $insert_status;
    }
}
// update a link
if (isset($_POST['update_link']) && $_POST['update_link'] == 'update') {
    $link_id = (int) $_GET['link_id'];
    $update_status = update_link($link_id);
    if ($update_status === true) {
        header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=links&link_id=' . $link_id);
    } else {
        $error = $update_status;
    }
    $return['data'] = $item_html;
    $return['msg'] = _('Link inserted successfully');
    return $return;
}
$login = Session::get_session_user();
$db = new ossim_db();
$conn = $db->connect();
$action = POST('action');
$data = POST('data');
ossim_valid($action, OSS_DIGIT, 'illegal:' . _('Action'));
if (ossim_error()) {
    die(ossim_error());
}
if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    switch ($action) {
        case 1:
            $response = get_link_select($conn, $data);
            break;
        case 2:
            $response = delete_link($conn, $data);
            break;
        case 3:
            $response = insert_link($conn, $data);
            break;
        default:
            $response['error'] = TRUE;
            $response['msg'] = 'Wrong Option Chosen';
    }
    echo json_encode($response);
    $db->close();
}