Ejemplo n.º 1
0
 static function delete($attachment_id, $file = true)
 {
     if ($file) {
         $attachment = new self($attachment_id);
         @unlink(uploaded($attachment->path, true));
     }
     parent::destroy(get_class(), $attachment_id);
 }
Ejemplo n.º 2
0
 static function __uninstall($confirm)
 {
     if ($confirm) {
         foreach (Attachment::find() as $attachment) {
             @unlink(uploaded($attachment->path, true));
         }
         SQL::current()->query("DROP TABLE __attachments");
     }
 }
Ejemplo n.º 3
0
 public function image_link($post, $max_width = 500, $max_height = null, $more_args = "quality=100")
 {
     $source = !empty($post->source) ? $post->source : uploaded($post->filename);
     return '<a href="' . $source . '">' . $this->image_tag($post, $max_width, $max_height, $more_args) . '</a>';
 }
Ejemplo n.º 4
0
 /**
  * Function: delete
  * Deletes the given topic. Calls the "delete_topic" trigger and passes the <Topic> as an argument.
  *
  * Parameters:
  *     $id - The topic to delete.
  */
 static function delete($id)
 {
     $topic = new self($id);
     foreach ($topic->message as $message) {
         Message::delete($message->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($topic->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Ejemplo n.º 5
0
    public function update_version()
    {
        if (!isset($_POST['version_id'])) {
            error(__("Error"), __("No version ID specified.", "extend"));
        }
        $version = new Version($_POST['version_id'], array("filter" => false));
        if ($version->no_results) {
            error(__("Error"), __("Invalid version ID specified.", "extend"));
        }
        if (!$version->editable()) {
            show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this version.", "extend"));
        }
        $files = array();
        if (!empty($_FILES['attachment'])) {
            foreach ($_FILES['attachment'] as $key => $val) {
                foreach ($val as $file => $attr) {
                    $files[$file][$key] = $attr;
                }
            }
        }
        foreach ($files as $attachment) {
            if ($attachment['error'] != 4) {
                $path = upload($attachment, null, "attachments");
                Attachment::add(basename($path), $path, "version", $version->id);
            }
        }
        $version->extension->update($_POST['name']);
        if ($_FILES['extension']['error'] == 0) {
            @unlink(uploaded($version->filename, true));
            # Add the MIT license if no license is specified
            $zip = new ZipArchive();
            if ($zip->open($_FILES['extension']['tmp_name']) === true and $zip->locateName("LICENSE") === false) {
                $header = "Copyright (c) " . date("Y") . " " . oneof($visitor->full_name, $visitor->login);
                $mit = <<<EOF
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name(s) of the above
copyright holders shall not be used in advertising or otherwise
to promote the sale, use or other dealings in this Software
without prior written authorization.
EOF;
                $zip->addFromString("LICENSE", $header . "\n\n" . $mit . "\n");
                $zip->close();
            }
            $filename = upload($_FILES['extension'], "zip", "extension/" . pluralize($version->extension->type->url));
        } else {
            $filename = $version->filename;
        }
        if ($_FILES['image']['error'] == 0) {
            @unlink(uploaded($version->image, true));
            $image = upload($_FILES['image'], null, "previews/" . pluralize($version->extension->type->url));
        } else {
            $image = $version->image;
        }
        $version->update($_POST['number'], $_POST['description'], comma_sep($_POST['compatible']), comma_sep($_POST['tags']), $filename, $image);
        Flash::notice(__("Version updated.", "extend"), $version->url());
    }
Ejemplo n.º 6
0
 public function audio_player($filename, $params = array(), $post)
 {
     $vars = "";
     foreach ($params as $name => $val) {
         $vars .= "&amp;" . $name . "=" . $val;
     }
     $config = Config::current();
     $player = "\n\t" . '<div id="jquery_jplayer_' . $post->id . '" class="jp-jplayer"></div>';
     $player .= "\n\t" . '<div id="jp_container_' . $post->id . '" class="jp-audio">';
     $player .= "\n\t\t" . '<div class="jp-type-single">';
     $player .= "\n\t\t\t" . '<div class="jp-gui jp-interface" style="display:none;">';
     $player .= "\n\t\t\t\t" . '<ul class="jp-controls">';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>';
     $player .= "\n\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>';
     $player .= "\n\t\t\t\t" . '</ul>';
     $player .= "\n\t\t\t\t" . '<div class="jp-progress">';
     $player .= "\n\t\t\t\t\t" . '<div class="jp-seek-bar">';
     $player .= "\n\t\t\t\t\t\t" . '<div class="jp-play-bar"></div>';
     $player .= "\n\t\t\t\t\t" . '</div>';
     $player .= "\n\t\t\t\t" . '</div>';
     $player .= "\n\t\t\t\t" . '<div class="jp-volume-bar">';
     $player .= "\n\t\t\t\t\t" . '<div class="jp-volume-bar-value"></div>';
     $player .= "\n\t\t\t\t" . '</div>';
     $player .= "\n\t\t\t\t" . '<div class="jp-time-holder">';
     $player .= "\n\t\t\t\t\t" . '<div class="jp-current-time"></div>';
     $player .= "\n\t\t\t\t\t" . '<div class="jp-duration"></div>';
     $player .= "\n\t\t\t\t\t" . '<ul class="jp-toggles">';
     $player .= "\n\t\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>';
     $player .= "\n\t\t\t\t\t\t" . '<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>';
     $player .= "\n\t\t\t\t\t" . '</ul>';
     $player .= "\n\t\t\t\t" . '</div>';
     $player .= "\n\t\t\t" . '</div>';
     $player .= "\n\t\t\t" . '<div class="jp-no-solution">';
     $player .= "\n\t\t\t\t" . '<span>Update Required</span>';
     $player .= "\n\t\t\t\t" . 'To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.';
     $player .= "\n\t\t\t" . '</div>';
     $player .= "\n\t\t\t" . '<noscript>';
     $player .= "\n\t\t\t\t" . '<div class="jp-no-solution" style="display:block;">';
     $player .= "\n\t\t\t\t\t" . '<span>JavaScript Required</span>';
     $player .= "\n\t\t\t\t\t" . 'To play <a href="' . uploaded($post->filename) . '" type="' . $this->audio_type($post->filename) . '">' . truncate(strip_tags($post->description)) . '</a> you must enable JavaScript.';
     $player .= "\n\t\t\t\t" . '</div>';
     $player .= "\n\t\t\t" . '</noscript>';
     $player .= "\n\t\t" . '</div>';
     $player .= "\n\t" . '</div>';
     if (!file_exists(THEME_DIR . "/stylesheets/jplayer.css")) {
         $player .= "\n\t" . '<link href="' . $config->chyrp_url . '/feathers/audio/skin/blue.monday.hd/jplayer.blue.monday.hd.css" rel="stylesheet" type="text/css" />';
     }
     $player .= "\n\t" . '<script>';
     $player .= "\n\t" . '$(function(){';
     $player .= "\n\t\t" . '$("#jquery_jplayer_' . $post->id . '").jPlayer({';
     $player .= "\n\t\t\t" . 'ready: function() {';
     $player .= "\n\t\t\t\t" . '$(this).jPlayer("setMedia", {';
     $player .= "\n\t\t\t\t\t" . $this->audio_ext($post->filename) . ': "' . $config->chyrp_url . $config->uploads_path . $filename . '"';
     $player .= "\n\t\t\t\t" . '});';
     $player .= "\n\t\t\t" . '},';
     $player .= "\n\t\t\t" . 'play: function() {';
     $player .= "\n\t\t\t\t" . '$(this).jPlayer("pauseOthers");';
     $player .= "\n\t\t\t" . '},';
     $player .= "\n\t\t\t" . 'swfPath: "' . $config->chyrp_url . '/feathers/audio/jplayer/",';
     $player .= "\n\t\t\t" . 'supplied: "' . $this->audio_ext($post->filename) . '",';
     $player .= "\n\t\t\t" . 'wmode:"window",';
     $player .= "\n\t\t\t" . 'solution: "html,flash",';
     $player .= "\n\t\t\t" . 'cssSelectorAncestor: "#jp_container_' . $post->id . '",';
     $player .= "\n\t\t\t" . 'preload: "auto"';
     $player .= "\n\t\t" . '});';
     $player .= "\n\t" . '});';
     $player .= "\n\t" . '</script>' . "\n";
     return $player;
 }
Ejemplo n.º 7
0
 /**
  * Function: delete
  * Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
  *
  * Parameters:
  *     $id - The version to delete.
  */
 static function delete($id)
 {
     $version = new self($id);
     foreach ($version->notes as $note) {
         Note::delete($note->id);
     }
     foreach ($version->attachments as $attachment) {
         Attachment::delete($attachment->id);
     }
     @unlink(uploaded($version->filename, false));
     @unlink(uploaded($version->preview, false));
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Ejemplo n.º 8
0
 public function file_link($post)
 {
     return uploaded($post->filename);
 }
Ejemplo n.º 9
0
 public function enclose_mp3($post)
 {
     $config = Config::current();
     if ($post->feather != "audio" or !file_exists(uploaded($post->filename, false))) {
         return;
     }
     $length = filesize(uploaded($post->filename, false));
     echo '          <link rel="enclosure" href="' . uploaded($post->filename) . '" type="audio/mpeg" title="MP3" length="' . $length . '" />' . "\n";
 }
Ejemplo n.º 10
0
    echo "http code:" . ($http = substr($headers[0], 9, 3) . "<br />");
    if ($host == "ryushare.com") {
        ryushare($link);
    } elseif ($host == "bitshare.com") {
        bitshare($link);
    } elseif ($host == "freakshare.com") {
        freakshare($link);
    } elseif ($host == "zefile.com") {
        zefile($link);
    } elseif ($host == "ultramegabit.com") {
        ultramegabit($link);
    } elseif ($host == "uploaded.net") {
        if ($http == 302) {
            echo "link is er af";
        } else {
            uploaded($link);
        }
    } elseif ($host == "lumfile.com") {
        lumfile($link);
    } elseif ($host == "turbobit.net") {
        turbobit($link);
    } elseif ($host == "cloudzer.net") {
        clz($link);
    } elseif ($host == "www.filefactory.com") {
        filefactory($link);
    } elseif ($host == "rapidgator.net") {
        rapidgator($link);
    } else {
        echo "Deze filehoster is nog niet toegvoegt aan het systeem";
    }
} else {
Ejemplo n.º 11
0
 /**
  * Function: delete
  * Deletes the given ticket, including its revisions and attachment. Calls the "delete_ticket" trigger and passes the <Ticket> as an argument.
  *
  * Parameters:
  *     $id - The ticket to delete.
  */
 static function delete($id)
 {
     $ticket = new self($id);
     foreach ($ticket->revisions as $revision) {
         Revision::delete($revision->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($ticket->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }