Exemplo n.º 1
0
                        if (cu3er__url_exists($settings['cu3er_location'])) {
                            unset($xml['Settings']['cu3er_location']);
                        }
                    }
                    if ($settings['js_location'] != '') {
                        if (cu3er__url_exists($settings['js_location'])) {
                            unset($xml['Settings']['js_location']);
                        }
                    }
                    if ($settings['js_player_location'] != '') {
                        if (cu3er__url_exists($settings['js_player_location'])) {
                            unset($xml['Settings']['js_player_location']);
                        }
                    }
                    if ($settings['licence'] != '') {
                        unset($xml['Settings']['licence']);
                    }
                    if ($settings['id'] == 1) {
                        $xml['Settings']['id'] = 1;
                    }
                    cu3er__sql_magic($wpdb->prefix . 'cu3er__settings', $xml['Settings']);
                    @touch($uplDir . '/CU3ER.txt');
                    cu3er__writeToFile($id);
                    echo 'Project successfully imported!';
                } else {
                    echo mysql_error();
                }
            }
        }
    }
}
Exemplo n.º 2
0
function cu3er__readFromFile($id)
{
    if (is_numeric($id)) {
        global $wpdb;
        $uploadsDir = wp_upload_dir();
        $rows = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "cu3er__slideshows` WHERE `id`='" . $id . "'", ARRAY_A) or die(mysql_error());
        foreach ($rows as $row) {
            foreach ($row as $key => $value) {
                $row[$key] = stripslashes($value);
            }
            $slideshowS = str_replace("'", "\\'", $row);
        }
        if ($slideshowS['project_location'] != '') {
            $oldDir = $slideshowS['project_location'];
        } else {
            $pth = explode("/", $slideshowS['xml_location']);
            $delFlag = true;
            $size = sizeof($pth);
            $wpContentDirArray = explode('/', WP_CONTENT_DIR);
            $wpContentDir = $wpContentDirArray[sizeof($wpContentDirArray) - 1];
            for ($i = 0; $i < $size; $i++) {
                if ($pth[$i] == $wpContentDir) {
                    unset($pth[$i], $pth[$i + 1]);
                    $delFlag = false;
                }
                if ($delFlag == true) {
                    unset($pth[$i]);
                }
            }
            $pthOld = $pth;
            unset($pthOld[9], $pthOld[10], $pthOld[11], $pthOld[12]);
            $oldDir = $uploadsDir['basedir'] . '/' . implode("/", $pthOld);
        }
        if (!file_exists($oldDir . '/CU3ER.txt') || file_get_contents($oldDir . '/CU3ER.txt') == '') {
            $var = cu3er__writeToFile($id, true);
            return $var;
        } else {
            return file_get_contents($oldDir . '/CU3ER.txt');
        }
    }
}