コード例 #1
0
    public function update()
    {
        global $DB;
        $ok = $DB->execute('
            UPDATE nv_websites
                SET
                    name	=   ?,
                    protocol =  ?,
                    subdomain = ?,
                    domain	=   ?,
                    folder	=   ?,
                    redirect_to = ?,
                    wrong_path_action = ?,
                    wrong_path_redirect = ?,
                    empty_path_action = ?,
                    languages = ?,
                    languages_published = ?,
                    aliases = ?,
                    word_separator = ?,
                    date_format = ?,
                    tinymce_css = ?,
                    resize_uploaded_images = ?,
                    comments_enabled_for = ?,
					comments_default_moderator = ?,
					share_files_media_browser = ?,
                    additional_scripts = ?,
                    permission = ?,
                    mail_mailer = ?,
                    mail_server = ?,
                    mail_port = ?,
                    mail_security = ?,
                    mail_user = ?,
                    mail_address = ?,
                    mail_password = ?,
                    contact_emails = ?,
                    homepage = ?,
                    default_timezone = ?,
                    metatag_description = ?,
                    metatag_keywords = ?,
                    metatags = ?,
                    favicon = ?,
                    theme = ?,
                    theme_options = ?
                WHERE id = ' . $this->id, array(value_or_default($this->name, ""), value_or_default($this->protocol, "http://"), value_or_default($this->subdomain, ""), value_or_default($this->domain, ""), value_or_default($this->folder, ""), value_or_default($this->redirect_to, ""), value_or_default($this->wrong_path_action, "blank"), value_or_default($this->wrong_path_redirect, ""), value_or_default($this->empty_path_action, "homepage_redirect"), is_array($this->languages) ? serialize($this->languages) : $this->languages, is_array($this->languages_published) ? serialize($this->languages_published) : $this->languages_published, json_encode($this->aliases), value_or_default($this->word_separator, "-"), $this->date_format, value_or_default($this->tinymce_css, ""), $this->resize_uploaded_images, $this->comments_enabled_for, $this->comments_default_moderator, $this->share_files_media_browser, $this->additional_scripts, $this->permission, value_or_default($this->mail_mailer, ""), value_or_default($this->mail_server, ""), value_or_default($this->mail_port, 25), value_or_default($this->mail_security, 0), value_or_default($this->mail_user, ""), value_or_default($this->mail_address, ""), value_or_default($this->mail_password, ""), serialize($this->contact_emails), $this->homepage, $this->default_timezone, json_encode($this->metatag_description), json_encode($this->metatag_keywords), json_encode($this->metatags), value_or_default($this->favicon, 0), value_or_default($this->theme, ""), json_encode($this->theme_options)));
        if (!$ok) {
            throw new Exception($DB->get_last_error());
        }
        if (!file_exists(NAVIGATE_PRIVATE . '/' . $this->id)) {
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id, 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/files', 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/templates', 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/thumbnails', 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/webgets', 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/backups', 0755, true);
            @mkdir(NAVIGATE_PRIVATE . '/' . $this->id . '/cache', 0755, true);
        }
        // if allowed, send statistics to navigatecms.com
        if (NAVIGATECMS_STATS) {
            global $user;
            @core_curl_post('http://statistics.navigatecms.com/website/update', array('ip' => $_SERVER['SERVER_ADDR'], 'website_id' => $this->id, 'name' => $this->name, 'url' => $this->absolute_path(), 'folder' => $this->folder, 'word_separator' => $this->word_separator, 'homepage' => $this->homepage, 'theme' => $this->theme, 'emails' => serialize($this->contact_emails), 'languages' => serialize($this->languages_published), 'permission' => $this->permission, 'author_name' => $user->username, 'author_email' => $user->email, 'author_language' => $user->language), NULL, 10, 'post');
        }
        return true;
    }
コード例 #2
0
function nvweb_template_oembed_cache($provider, $oembed_url, $minutes = 43200)
{
    $file = NAVIGATE_PRIVATE . '/oembed/' . $provider . '.' . md5($oembed_url) . '.json';
    if (file_exists($file) && filemtime($file) > time() - $minutes * 60) {
        // a previous request has already been posted in the last xx minutes
        $response = file_get_contents($file);
    } else {
        // request has not been cached or it has expired
        $response = core_curl_post($oembed_url, NULL, NULL, 60, "get");
        if ($response == 'Not found') {
            $response = '';
        }
        if (!empty($response)) {
            file_put_contents($file, $response);
        }
    }
    if (!empty($response)) {
        $response = json_decode($response);
    }
    return $response;
}
コード例 #3
0
 public static function latest_available()
 {
     $list = extension::list_installed();
     $post = array();
     if (!is_array($list)) {
         return false;
     }
     foreach ($list as $extension) {
         $post[$extension['code']] = $extension['version'];
     }
     $latest_update = core_curl_post('http://update.navigatecms.com/extensions', array('extensions' => json_encode($post)));
     if (empty($latest_update)) {
         return false;
     }
     $latest_update = json_decode($latest_update, true);
     return $latest_update;
 }
コード例 #4
0
 public static function latest_available()
 {
     $list = theme::list_available();
     $post = array();
     if (!is_array($list)) {
         return false;
     }
     foreach ($list as $theme) {
         $post[$theme['code']] = $theme['version'];
     }
     $latest_update = core_curl_post('http://update.navigatecms.com/themes', array('themes' => json_encode($post)));
     if (empty($latest_update)) {
         return false;
     }
     $latest_update = json_decode($latest_update, true);
     return $latest_update;
 }