예제 #1
0
    $edit=true;
    $action=$m_action->get_action_by_id($_GET['id'])->result;
}else if (isset($_POST['title'])) {
    if (isset($_POST['id'])) {
        $action=$m_action->get_action_by_id($_POST['id'])->result;
        $data = array(
            'title' => $_POST['title'], 
            'description' => $_POST['description'], 
            'title_en' => $_POST['title_en'], 
            'description_en' => $_POST['description_en'], 
            'detail_title' => $_POST['detail_title'], 
            'detail_description' => substr($_POST['detail_description'], 0,4999), 
            'detail_title_en' => $_POST['detail_title_en'], 
            'detail_description_en' => substr($_POST['detail_description_en'], 0,4999), 
            );
        $m_action->update_action($data,$_POST['id']);
        $sort_order=1;
        foreach ($_POST['file_path'] as $key => $value) {
            $filename = $value;
            $pos = strpos($filename, "old_file_picture__");
            if ($pos === false&&$filename!="") {

                $ad_pid=$m_action->generate_pid();
                    $ext = explode(".", $filename);
                    $new_ext = $ext[count($ext) - 1];
                    $new_filename = $_POST['id'] . "_".$ad_pid."." . $new_ext;
                    $file = '../media/tmp/' . $filename;
                    $newfile = '../media/action/' . $new_filename;
                    
                    if (!copy($file, $newfile)) {
                        echo "failed to copy $file...\n" . $file . " to " . $newfile . "  and  ";
예제 #2
0
<?
require_once("../model/m_action.php");
$m_action = new M_action;
$edit=false;
$action=null;
$count=0;
foreach ($_POST['id'] as $key => $value) {
	$count+=1;
	$data = array('sort_order' => $count);
	$m_action->update_action($data,$value);
	echo $count."<br>";
}
?>