Example #1
0
 public function title($post)
 {
     $return = $post->name;
     fallback($return, $post->title_from_excerpt());
     fallback($return, $post->source);
     return $return;
 }
Example #2
0
 public function submit()
 {
     if (empty($_POST['video'])) {
         error(__("Error"), __("Video can't be blank."));
     }
     fallback($_POST['slug'], sanitize($_POST['title']));
     return Post::add(array("title" => $_POST['title'], "embed" => $this->embed_tag($_POST['video']), "video" => $_POST['video'], "caption" => $_POST['caption']), $_POST['slug'], Post::check_url($_POST['slug']));
 }
Example #3
0
 static function updateCategory($post = array())
 {
     $show_on_home = isset($post['show_on_home']) ? 1 : 0;
     $clean = sanitize(fallback($_POST['clean'], $_POST['name']));
     $name = $post['name'];
     $id = $post['id'];
     SQL::current()->update("categorize", "`id` = :id", array("name" => ":name", "clean" => ":clean", "show_on_home" => ":show_on_home"), array(":id" => $id, ":name" => $name, ":clean" => $clean, ":show_on_home" => $show_on_home));
 }
Example #4
0
 public function submit()
 {
     if (empty($_POST['body'])) {
         error(__("Error"), __("Body can't be blank."));
     }
     fallback($_POST['slug'], sanitize($_POST['title']));
     return Post::add(array("title" => $_POST['title'], "body" => $_POST['body']), $_POST['slug'], Post::check_url($_POST['slug']));
 }
 function setAttributesToFallback($default)
 {
     global $langColumns;
     for ($i = 0; $i < count($langColumns); $i++) {
         $id = $langColumns[$i];
         $this->m[$id] = fallback($this->m[$id], $default->m[$id]);
     }
 }
Example #6
0
 public function delete_link($text = null, $before = null, $after = null, $classes = "")
 {
     if (!$this->deletable()) {
         return false;
     }
     fallback($text, __("Delete"));
     $name = strtolower(get_class($this));
     echo $before . '<a href="' . url("delete_attachment/" . $this->id, MainController::current()) . '" title="Delete" class="' . ($classes ? $classes . " " : '') . $name . '_delete_link delete_link" id="' . $name . '_delete_' . $this->id . '">' . $text . '</a>' . $after;
 }
function dj_info_box($id = "0", $info = "Keine Infos", $feld_id, $name = "")
{
    global $sp_settings, $userdata, $locale;
    $ausgabe = "";
    if (!isnum($id)) {
        fallback("index.php");
    }
    if ($id > 0) {
        $info_result = dbquery("SELECT * FROM " . DB_USERS . " WHERE user_id='" . $id . "'");
        if (dbrows($info_result) != 0) {
            $user_info = dbarray($info_result);
            if (sp_check($sp_settings['grss_sgroup'], $user_info['user_groups'])) {
                $mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp125'] . "<br /><br />";
            } elseif (sp_check($sp_settings['grss_ggroup'], $user_info['user_groups'])) {
                $mod = "<b>" . $locale['grsp124'] . "</b><br />" . $locale['grsp126'] . "<br /><br />";
            } else {
                $mod = "";
            }
            if ($user_info['user_avatar'] != "") {
                $avatar = IMAGES . "avatars/" . $user_info['user_avatar'];
            } else {
                $avatar = IMAGES . "avatars/nopic.gif";
            }
            $infos = "<div align=\\'center\\'><img src=\\'" . $avatar . "\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $user_info['user_name'] . "</span><br /><br />" . $mod . "<b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
            $ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');" href="' . BASEDIR . 'profile.php?lookup=' . $user_info['user_id'] . '">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . $avatar . "\" height=\"40\" border=\"0\" /><br />" : "") . $user_info['user_name'] . '</a>';
            if ((sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) && $userdata['user_id'] == $user_info['user_id'] || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
                if ($sp_settings['grss_djedit'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
                    $ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
                }
                if ($sp_settings['grss_djoff'] == 1 || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
                    $ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
                }
            }
        }
    } elseif ($id == 0 && $name != "") {
        $infos = "<div align=\\'center\\'><img src=\\'" . IMAGES . "avatars/nopic.gif\\' /><br /><br /></div><b>" . $locale['grsp122'] . "</b><br /><span class=\\'info2\\'>" . $name . "</span><br /><br /><b>" . $locale['grsp123'] . "</b><br />" . $info . "<br /><br />";
        $ausgabe .= '<a onmouseover="return overlib(\'' . $infos . '\', STICKY, FGCLASS, \'sp1\', BGCLASS, \'sp2\', CAPTIONFONTCLASS, \'a\', CLOSEFONTCLASS, \'a\', CAPTION, \'' . $locale['grsp139'] . '\', RIGHT, CLOSETEXT, \' \');" onmouseout="return nd(\'true\');">' . ($sp_settings['grss_djpic'] == 1 ? "<img src=\"" . IMAGES . "avatars/nopic.gif\" height=\"40\" border=\"0\" /><br />" : "") . $name . '</a>';
        if (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
            $ausgabe .= "<br /><input type='submit' value='" . $locale['grsp130'] . "' class='button' style='width:80px;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=edit&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;' />";
            $ausgabe .= '<br /><form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_delete" value="' . $locale['grsp131'] . '" class="button" style="width:80px;" /></form>';
        }
    }
    if ($ausgabe == "") {
        if ($sp_settings['grss_djon'] == 1 && !($sp_settings['grss_week'] == 1 && $feld_id < 169) && (sp_group($sp_settings['grss_sgroup']) || sp_group($sp_settings['grss_ggroup'])) || sp_group($sp_settings['grss_agroup']) || iSUPERADMIN) {
            $ausgabe .= "<a href='javascript:;' onclick='popup=window.open(\"" . INFUSIONS . "gr_sendeplan/gr_sendeplan_popup.php?status=add&id=" . $feld_id . "\",\"DJ_Admin\",\"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=220,left=250,top=250\"); return false;'>" . $locale['grsp121'] . "</a>";
        } else {
            $ausgabe .= ($sp_settings['grss_djpic'] == 1 && $sp_settings['grss_autodjpic'] == 1 ? "<img src=\"" . INFUSIONS . "gr_sendeplan/autodj.gif\" height=\"40\" border=\"0\" /><br />" : "") . $locale['grsp120'];
        }
    }
    if ($sp_settings['grss_replay'] == 1 && $feld_id > 168 && (sp_group($sp_settings['grss_agroup']) || iSUPERADMIN)) {
        $info_result = dbquery("SELECT * FROM " . DB_GR_SENDEPLAN_REPLAY . " WHERE grsr_re_id='" . $feld_id . "'");
        if (dbrows($info_result) != 0) {
            $ausgabe .= '<form method="post" action="' . FUSION_SELF . '?id=' . $feld_id . '"><input type="submit" name="sp_re_delete" value="' . $locale['grsp140'] . '" class="button" style="width:80px;" /></form>';
        }
    }
    return $ausgabe;
}
Example #8
0
 /**
  * Function: __construct
  * Loads the configuration YAML file.
  */
 private function __construct()
 {
     if (!file_exists(INCLUDES_DIR . "/config.yaml.php")) {
         return false;
     }
     $contents = str_replace("<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n", "", file_get_contents(INCLUDES_DIR . "/config.yaml.php"));
     $this->yaml = YAML::load($contents);
     $arrays = array("enabled_modules", "enabled_feathers", "routes");
     foreach ($this->yaml as $setting => $value) {
         if (in_array($setting, $arrays) and empty($value)) {
             $this->{$setting} = array();
         } elseif (!is_int($setting)) {
             $this->{$setting} = is_string($value) ? stripslashes($value) : $value;
         }
     }
     fallback($this->url, $this->chyrp_url);
 }
Example #9
0
 public function submit()
 {
     if (!isset($_POST['filename'])) {
         if (isset($_FILES['photo']) and $_FILES['photo']['error'] == 0) {
             $filename = upload($_FILES['photo'], array("jpg", "jpeg", "png", "gif", "bmp"));
         } elseif (!empty($_POST['from_url'])) {
             $filename = upload_from_url($_POST['from_url'], array("jpg", "jpeg", "png", "gif", "bmp"));
         } else {
             error(__("Error"), __("Couldn't upload photo."));
         }
     } else {
         $filename = $_POST['filename'];
     }
     // Prepend scheme if a URL is detected
     if (preg_match('~^((([a-z]|[0-9]|\\-)+)\\.)+([a-z]){2,6}/~', @$_POST['option']['source'])) {
         $_POST['option']['source'] = "http://" . $_POST['option']['source'];
     }
     fallback($_POST['slug'], sanitize($_POST['title']));
     return Post::add(array("title" => $_POST['title'], "filename" => $filename, "caption" => $_POST['caption']), $_POST['slug'], Post::check_url($_POST['slug']));
 }
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
require_once '../include/admin.php';
if (!iPDP_ADMIN) {
    fallback('../index.php');
}
/****************************************************************************
 * ACTION
 */
if (isset($_GET['reset_visitors'])) {
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tcount_visitors='0'");
    if ($ok) {
        fallback(FUSION_SELF . '?done');
    }
}
/****************************************************************************
 * GUI
 */
opentable($locale['PDP016']);
pdp_admin_menu();
if (isset($_GET['done'])) {
    show_info($locale['pdp_done']);
}
/*
 * IMPORT
 */
echo '
<p>
Example #11
0
                if ($entry_count > 0) {
                    $entry_error = $locale["PR08"];
                } else {
                    $entry_insert = dbquery("INSERT INTO {$db_prefix}secsys_proxy_whitelist (proxy_ip, proxy_datestamp) VALUES('{$newproxy}','" . time() . "')");
                    if ($entry_insert) {
                        $entry_ok = $locale["PR07"];
                    } else {
                        $entry_error = $locale["PR06"];
                    }
                }
            } else {
                $entry_error = $locale["PR05"];
            }
        }
    }
    opentable($locale["PR01"]);
    echo "<center><a href='" . FUSION_SELF . "?lng=de'><img src='" . SEC_INFDIR . "images/flag-deu.png' border='0' alt='Deutsch' title='Deutsch'></a> <a href='" . FUSION_SELF . "?lng=en'><img src='" . SEC_INFDIR . "images/flag-eng.png' border='0' alt='English' title='English'></a></center><br>";
    if (!empty($_POST) && $entry_error != "") {
        echo "<div class='quote'>" . $entry_error . "</div><br>";
    }
    if (!isset($_POST['pentry'])) {
        echo $locale["PR02"];
        echo "<form action='" . FUSION_SELF . (FUSION_QUERY != "" ? "?" . rawurldecode(FUSION_QUERY) : "") . "' method='post'>\n<input type='hidden' name='newproxy' value='" . USER_IP . "'>" . $locale['PR09'] . ": " . USER_IP . "<br>\n<input type='checkbox' name='reaccept' value='1'>" . $locale['PR03'] . "<br>\n <input type='submit' value='" . $locale['PR04'] . "' name='pentry' class='button'></form>";
    } elseif (empty($entry_error)) {
        echo $entry_ok;
    }
    closetable();
} else {
    fallback(BASEDIR . "index.php");
}
require_once THEMES . "templates/footer.php";
Example #12
0
 function fallback_download()
 {
     fallback(INFUSIONS . 'pro_download_panel/download.php?did=' . $this->id);
 }
Example #13
0
            if ($data['parentcat'] != $catid) {
                continue;
            }
            if (!checkgroup($data['access']) && $prp->settings['hide_cats']) {
                continue;
            }
            $cnt_cats = prp_count_cats($id);
            $cnt_downs = prp_count_dl($all_cats, $id);
            $cats[$id] = array("name" => $data['name'], "cnt_downs" => $cnt_downs, "cnt_cats" => $cnt_cats, "desc" => parseubb($data['desc']));
        }
    }
    prp_render_cats($catid, $review->id, $path, $cats);
    unset($path, $cats);
    if (!is_null($access_group)) {
        if ($prp->settings['hide_cats']) {
            fallback("error.php?type=access");
        }
        show_info('<img src="icons/lock.png" alt="' . $locale['prp_locked'] . '" /> ' . str_replace('%s', getgroupname($access_group), $locale['PRP215']));
    }
}
/***************************************************************************
 *  DOWNLOADS                                                              *
 ***************************************************************************/
if (is_null($access_group) && !$review->id && (!isset($catid) || $catid != 0)) {
    $rowstart = 0;
    if (isset($_GET['rowstart']) && isNum($_GET['rowstart'])) {
        $rowstart = $_GET['rowstart'];
    }
    $downs = array();
    if (isset($catid)) {
        $get = array('type' => 'cat', 'data' => $catid);
Example #14
0
/**
 * Function: relative_time
 * Returns the difference between the given timestamps or now.
 *
 * Parameters:
 *     $time - Timestamp to compare to.
 *     $from - Timestamp to compare from. If not specified, defaults to now.
 *
 * Returns:
 *     A string formatted like "3 days ago" or "3 days from now".
 */
function relative_time($when, $from = null)
{
    fallback($from, time());
    $time = is_numeric($when) ? $when : strtotime($when);
    $difference = $from - $time;
    if ($difference < 0) {
        $word = "from now";
        $difference = -$difference;
    } elseif ($difference > 0) {
        $word = "ago";
    } else {
        return "just now";
    }
    $units = array("second" => 1, "minute" => 60, "hour" => 60 * 60, "day" => 60 * 60 * 24, "week" => 60 * 60 * 24 * 7, "month" => 60 * 60 * 24 * 30, "year" => 60 * 60 * 24 * 365, "decade" => 60 * 60 * 24 * 365 * 10, "century" => 60 * 60 * 24 * 365 * 100, "millennium" => 60 * 60 * 24 * 365 * 1000);
    $possible_units = array();
    foreach ($units as $name => $val) {
        if ($name == "week" and $difference >= $val * 2 or $name != "week" and $difference >= $val) {
            $unit = $possible_units[] = $name;
        }
    }
    $precision = (int) in_array("year", $possible_units);
    $amount = round($difference / $units[$unit], $precision);
    return $amount . " " . pluralize($unit, $amount) . " " . $word;
}
Example #15
0
                    <select name="adapter" id="adapter">
                        <?php 
    if (class_exists("PDO") and in_array("mysql", PDO::getAvailableDrivers()) or class_exists("MySQLi") or function_exists("mysql_query")) {
        ?>
                        <option value="mysql"<?php 
        selected("mysql", fallback($_POST['adapter'], "mysql"));
        ?>
>MySQL</option>
                        <?php 
    }
    ?>
                        <?php 
    if (class_exists("PDO") and in_array("sqlite", PDO::getAvailableDrivers())) {
        ?>
                        <option value="sqlite"<?php 
        selected("sqlite", fallback($_POST['adapter'], "mysql"));
        ?>
>SQLite 3</option>
                        <?php 
    }
    ?>
                        <?php 
    if (class_exists("PDO") and in_array("pgsql", PDO::getAvailableDrivers())) {
        ?>
                        <option value="pgsql"<?php 
        selected("pgsql", oneof(@$_POST['adapter'], "mysql"));
        ?>
>PostgreSQL</option>
                        <?php 
    }
    ?>
Example #16
0
<?php

/***************************************************************************
 *   awEventCalendar                                                       *
 *                                                                         *
 *   Copyright (C) 2006-2008 Artur Wiebe                                   *
 *   wibix@gmx.de                                                          *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
require_once 'include/common.php';
if (!iAWEC_ADMIN) {
    fallback('index.php');
}
/*
 * GUI
 */
opentable($locale['EC500']);
awec_menu();
$query_id = dbquery("SELECT ev.*, fu.user_name,\n\tDATE_FORMAT(ev_start, '" . $awec_settings['date_fmt'] . "') AS date,\n\tDATE_FORMAT(ev_start_time, '" . $awec_settings['time_fmt'] . "') AS start_time,\n\tDATE_FORMAT(ev_end_time, '" . $awec_settings['time_fmt'] . "') AS end_time\n\tFROM " . AWEC_DB_EVENTS . " AS ev\n\tLEFT JOIN " . DB_USERS . " AS fu ON ev.user_id=fu.user_id\n\tWHERE ev_status=" . AWEC_PENDING);
if (!dbrows($query_id)) {
    echo "<p>" . $locale['EC501'];
}
while ($data = dbarray($query_id)) {
    awec_render_event($data, "&amp;time=" . $data['ctime'] . "&amp;back_to=new");
}
closetable();
require_once 'include/die.php';
Example #17
0
 /**
  * Function: edit_link
  * Outputs an edit link for the model, if the visitor's <Group.can> edit_[model].
  *
  * Parameters:
  *     $text - The text to show for the link.
  *     $before - If the link can be shown, show this before it.
  *     $after - If the link can be shown, show this after it.
  *     $classes - Extra CSS classes for the link, space-delimited.
  */
 public function edit_link($text = null, $before = null, $after = null, $classes = "")
 {
     if (!$this->editable()) {
         return false;
     }
     fallback($text, __("Edit"));
     $name = strtolower(get_class($this));
     if (@Feathers::$instances[$this->feather]->disable_ajax_edit) {
         $classes = empty($classes) ? "no_ajax" : $classes . " no_ajax";
     }
     echo $before . '<a href="' . Config::current()->chyrp_url . '/admin/?action=edit_' . $name . '&amp;id=' . $this->id . '" title="Edit" class="' . ($classes ? $classes . " " : '') . $name . '_edit_link edit_link" id="' . $name . '_edit_' . $this->id . '">' . $text . '</a>' . $after;
 }
Example #18
0
        break;
    case 7:
        require_once THEMES . 'templates/header.php';
        break;
    case 'FF':
        break;
    default:
        die;
}
/*
 * get download
 */
require_once INFUSIONS . 'pro_download_panel/include/class.download.php';
$download = new pdpDownload(isset($_GET['did']) && isNum($_GET['did']) ? $_GET['did'] : 0);
if ($download->id && $download->status != PDP_PRO_ON && !$download->can_edit) {
    fallback('download.php?catid=' . $download->data['cat_id']);
}
/*
 * FUNCS
 */
// bb-buttons and smileys
function pdp_get_bb_smileys($input, $val, $is_enabled, $show_smileys = true)
{
    global $locale;
    return '
<input type="button" value="b" class="button" style="font-weight:bold;"
	onclick="addText(\'' . $input . '\', \'[b]\', \'[/b]\');" />
<input type="button" value="i" class="button" style="font-style:italic;"
	onclick="addText(\'' . $input . '\', \'[i]\', \'[/i]\');" />
<input type="button" value="u" class="button" style="text-decoration:underline;"
	onclick="addText(\'' . $input . '\', \'[u]\', \'[/u]\');" />
Example #19
0
$extension = pathinfo($filename, PATHINFO_EXTENSION);
if (!file_exists($filename)) {
    display_error("Image Not Found");
}
function display_error($string)
{
    $thumbnail = imagecreatetruecolor(oneof(@$_GET['max_width'], 100), 18);
    imagestring($thumbnail, 1, 5, 5, $string, imagecolorallocate($thumbnail, 255, 255, 255));
    header("Content-type: image/png");
    header("Content-Disposition: inline; filename=error.png");
    imagepng($thumbnail);
    exit;
}
list($original_width, $original_height, $type, $attr) = getimagesize($filename);
$new_width = (int) fallback($_GET["max_width"], 0);
$new_height = (int) fallback($_GET["max_height"], 0);
$crop_x = 0;
$crop_y = 0;
function resize(&$crop_x, &$crop_y, &$new_width, &$new_height, $original_width, $original_height)
{
    $xscale = $new_width / $original_width;
    $yscale = $new_height / $original_height;
    if ($new_width <= $original_width and $new_height <= $original_height and $xscale == $yscale) {
        return;
    }
    if (isset($_GET['square'])) {
        if ($new_width === 0) {
            $new_width = $new_height;
        }
        if ($new_height === 0) {
            $new_height = $new_width;
Example #20
0
 /**
  * Function: delete_link
  * Outputs a delete link for the post, if the <User.can> delete_[model].
  *
  * Parameters:
  *     $text - The text to show for the link.
  *     $before - If the link can be shown, show this before it.
  *     $after - If the link can be shown, show this after it.
  *     $classes - Extra CSS classes for the link, space-delimited.
  */
 public function delete_link($text = null, $before = null, $after = null, $classes = "")
 {
     if (!$this->deletable()) {
         return false;
     }
     fallback($text, __("Delete"));
     $name = strtolower(get_class($this));
     echo $before . '<a href="' . Config::current()->chyrp_url . '/admin/?action=delete_' . $name . '&amp;id=' . $this->id . '" title="Delete" class="' . ($classes ? $classes . " " : '') . $name . '_delete_link delete_link" id="' . $name . '_delete_' . $this->id . '">' . $text . '</a>' . $after;
 }
Example #21
0
</h1>
            <div class="message">
                <?php 
echo $body;
if (!empty($backtrace)) {
    ?>
                <h2><?php 
    echo __("Backtrace");
    ?>
</h2>
                <ol class="backtrace">
<?php 
    foreach ($backtrace as $trace) {
        ?>
                    <li><code><?php 
        echo _f("%s on line %d", array($trace["file"], fallback($trace["line"], 0)));
        ?>
</code></li>
<?php 
    }
    ?>
                </ol>
<?php 
}
?>
                <div class="clear"></div>
<?php 
if (!logged_in() and $body != __("Route was initiated without a Controller.")) {
    ?>
                <a href="<?php 
    echo url("login");
Example #22
0
 /**
  * Function: feed
  * Grabs posts for the feed.
  */
 public function feed($posts = null)
 {
     if (!substr_count($_SERVER['HTTP_USER_AGENT'], "FeedBurner")) {
         redirect(Config::current()->feed_url);
     }
     fallback($posts, Post::find(array("limit" => Config::current()->feed_items)));
     header("Content-Type: application/atom+xml; charset=UTF-8");
     if (!is_array($posts)) {
         $posts = $posts->paginated;
     }
     $latest_timestamp = 0;
     foreach ($posts as $post) {
         if (strtotime($post->created_at) > $latest_timestamp) {
             $latest_timestamp = strtotime($post->created_at);
         }
     }
     require INCLUDES_DIR . "/feed.php";
 }
Example #23
0
    if ($ok) {
        $download->log_event(PDP_EV_CHEAT, 0);
        fallback(FUSION_SELF . "?did=" . $download->id);
    }
} elseif (isset($_POST['set_max_pics'])) {
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tmax_pics='" . intval($_POST['max_pics']) . "'\n\t\tWHERE download_id='" . $download->id . "'");
    if ($ok) {
        fallback(FUSION_SELF . '?did=' . $download->id);
    }
} elseif (isset($_POST['set_dir_files'])) {
    if (!in_array($_POST['dir_files'], $upload_file_dirs)) {
        fallback(FUSION_SELF . '?did=' . $download->id);
    }
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tdir_files='" . $_POST['dir_files'] . "'\n\t\tWHERE download_id='" . $download->id . "'");
    if ($ok) {
        fallback(FUSION_SELF . '?did=' . $download->id);
    }
}
/****************************************************************************
 * GUI
 */
if (isset($_GET['errno'])) {
    pdp_process_errno($_GET['errno']);
}
opentable($locale['PDP450']);
echo '
<a href="admin/del_download.php?did=' . $download->id . '">' . $locale['PDP880'] . '</a>
<hr />';
$sel_status = '';
foreach ($locale['PDP904'] as $val => $title) {
    $sel_status .= '<option value="' . $val . '"' . ($val == $download->status ? ' selected="selected"' : '') . '>' . $title . '</option>';
Example #24
0
# Set the locale for gettext.
set_locale($config->locale);
# Load the translation engine.
load_translator("chyrp", INCLUDES_DIR . "/locale/" . $config->locale . ".mo");
# Constant: PREVIEWING
# Is the user previewing a theme?
define('PREVIEWING', !ADMIN and !empty($_SESSION['theme']));
# Constant: THEME_DIR
# Absolute path to /themes/(current/previewed theme)
define('THEME_DIR', MAIN_DIR . "/themes/" . (PREVIEWING ? $_SESSION['theme'] : $config->theme));
# Constant: THEME_URL
# URL to /themes/(current/previewed theme)
define('THEME_URL', $config->chyrp_url . "/themes/" . (PREVIEWING ? $_SESSION['theme'] : $config->theme));
# Initialize the theme.
$theme = Theme::current();
# Load the Visitor.
$visitor = Visitor::current();
# Prepare the notifier.
$flash = Flash::current();
# Initiate the extensions.
init_extensions();
# Prepare the trigger class
$trigger = Trigger::current();
# Filter the visitor immediately after the Modules are initialized.
# Example usage scenario: custom auth systems (e.g. OpenID)
$trigger->filter($visitor, "visitor");
# First general-purpose trigger. There are many cases you may want to use @route_init@ instead of this, however.
$trigger->call("runtime");
# Set the content-type to the theme's "type" setting, or "text/html".
header("Content-type: " . (INDEX ? fallback($theme->type, "text/html") : "text/html") . "; charset=UTF-8");
    $all_cats[$data['cat_id']] = array("name" => $data['cat_name'], "parentcat" => $data['top_cat'], "access" => $data['cat_upload_access']);
}
function pdp_tmp_show_cat($parentid, $cat_array, $level, $sel_this)
{
    $retval = "";
    foreach ($cat_array as $myid => $thiscat) {
        if ($thiscat['parentcat'] == $parentid && checkgroup($thiscat['access'])) {
            $retval .= "<option value='{$myid}'" . ($sel_this == $myid ? ' selected="selected"' : '') . '>' . str_repeat("&nbsp;", $level * 4) . $thiscat['name'] . '</option>';
            $retval .= pdp_tmp_show_cat($myid, $cat_array, $level + 1, $sel_this);
        }
    }
    return $retval;
}
$sel_cats = pdp_tmp_show_cat(0, $all_cats, 0, $download->data['cat_id']);
if (empty($sel_cats)) {
    fallback("error.php?type=cats");
}
/*
 * GUI
 */
if (!$download->id || $download->status == PDP_PRO_NEW) {
    pdp_upload_step(1, $download->id ? "edit_files.php" : "");
    $button = $locale['PDP044'] . " 2";
    $caption = $locale['PDP103'];
} else {
    $button = $locale['PDP010'];
    $caption = $locale['PDP025'];
}
opentable($caption);
if (isset($_GET['errno'])) {
    pdp_process_errno($_GET['errno']);
Example #26
0
File: Admin.php Project: eadz/chyrp
 /**
  * Function: display
  * Renders the page.
  *
  * Parameters:
  *     $action - The template file to display, in (theme dir)/pages.
  *     $context - Context for the template.
  *     $title - The title for the page. Defaults to a camlelization of the action, e.g. foo_bar -> Foo Bar.
  */
 public function display($action, $context = array(), $title = "")
 {
     $this->displayed = true;
     fallback($title, camelize($action, true));
     $this->context = array_merge($context, $this->context);
     $trigger = Trigger::current();
     $trigger->filter($this->context, array("admin_context", "admin_context_" . str_replace("/", "_", $action)));
     # Are there any extension-added pages?
     foreach (array("write" => array(), "manage" => array("import", "export"), "settings" => array(), "extend" => array("modules", "feathers", "themes")) as $main_nav => $val) {
         ${$main_nav} = $val;
         $trigger->filter(${$main_nav}, $main_nav . "_pages");
     }
     $visitor = Visitor::current();
     $route = Route::current();
     $this->context["theme"] = Theme::current();
     $this->context["flash"] = Flash::current();
     $this->context["trigger"] = $trigger;
     $this->context["title"] = $title;
     $this->context["site"] = Config::current();
     $this->context["visitor"] = $visitor;
     $this->context["logged_in"] = logged_in();
     $this->context["route"] = $route;
     $this->context["hide_admin"] = isset($_SESSION["hide_admin"]);
     $this->context["now"] = time();
     $this->context["version"] = CHYRP_VERSION;
     $this->context["debug"] = DEBUG;
     $this->context["feathers"] = Feathers::$instances;
     $this->context["modules"] = Modules::$instances;
     $this->context["admin_theme"] = $this->admin_theme;
     $this->context["theme_url"] = Config::current()->chyrp_url . "/admin/themes/" . $this->admin_theme;
     $this->context["POST"] = $_POST;
     $this->context["GET"] = $_GET;
     $this->context["navigation"] = array();
     $show = array("write" => array($visitor->group->can("add_draft", "add_post", "add_page")), "manage" => array($visitor->group->can("view_own_draft", "view_draft", "edit_own_draft", "edit_own_post", "edit_post", "delete_own_draft", "delete_own_post", "delete_post", "add_page", "edit_page", "delete_page", "add_user", "edit_user", "delete_user", "add_group", "edit_group", "delete_group")), "settings" => array($visitor->group->can("change_settings")), "extend" => array($visitor->group->can("toggle_extensions")));
     foreach ($show as $name => &$arr) {
         $trigger->filter($arr, $name . "_nav_show");
     }
     $this->context["navigation"]["write"] = array("title" => __("Write"), "show" => in_array(true, $show["write"]), "selected" => in_array($action, $write) or match("/^write_/", $action));
     $this->context["navigation"]["manage"] = array("title" => __("Manage"), "show" => in_array(true, $show["manage"]), "selected" => in_array($action, $manage) or match(array("/^manage_/", "/^edit_/", "/^delete_/", "/^new_/"), $action));
     $this->context["navigation"]["settings"] = array("title" => __("Settings"), "show" => in_array(true, $show["settings"]), "selected" => in_array($action, $settings) or match("/_settings\$/", $action));
     $this->context["navigation"]["extend"] = array("title" => __("Extend"), "show" => in_array(true, $show["extend"]), "selected" => in_array($action, $extend));
     $this->subnav_context($route->action);
     $trigger->filter($this->context["selected"], "nav_selected");
     $this->context["sql_debug"] = SQL::current()->debug;
     $file = MAIN_DIR . "/admin/themes/%s/pages/" . $action . ".twig";
     $template = file_exists(sprintf($file, $this->admin_theme)) ? sprintf($file, $this->admin_theme) : sprintf($file, "default");
     $config = Config::current();
     if (!file_exists($template)) {
         foreach (array(MODULES_DIR => $config->enabled_modules, FEATHERS_DIR => $config->enabled_feathers) as $path => $try) {
             foreach ($try as $extension) {
                 if (file_exists($path . "/" . $extension . "/pages/admin/" . $action . ".twig")) {
                     $template = $path . "/" . $extension . "/pages/admin/" . $action . ".twig";
                 }
             }
         }
         if (!file_exists($template)) {
             error(__("Template Missing"), _f("Couldn't load template: <code>%s</code>", array($template)));
         }
     }
     # Try the theme first
     try {
         $this->theme->getTemplate($template)->display($this->context);
     } catch (Exception $t) {
         # Fallback to the default
         try {
             $this->default->getTemplate($template)->display($this->context);
         } catch (Exception $e) {
             $prettify = preg_replace("/([^:]+): (.+)/", "\\1: <code>\\2</code>", $e->getMessage());
             $trace = debug_backtrace();
             $twig = array("file" => $e->filename, "line" => $e->lineno);
             array_unshift($trace, $twig);
             error(__("Error"), $prettify, $trace);
         }
     }
 }
Example #27
0
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../../maincore.php";
require_once THEME . "theme.php";
echo "<link rel='stylesheet' href='" . THEME . "styles.css' type='text/css'>";
if (!checkRights("I")) {
    header("Location:../../../index.php");
    exit;
}
if (isset($game) && !isNum($game)) {
    fallback("index.php");
}
if (!defined("LANGUAGE")) {
    // PHPFusion environment
    $this_lang = str_replace("/", "", LOCALESET);
    if (file_exists(INFUSIONS . "varcade/locale/" . $this_lang . ".php")) {
        include INFUSIONS . "varcade/locale/" . $this_lang . ".php";
    } else {
        include INFUSIONS . "varcade/locale/English.php";
    }
} else {
    // mFusion environment
    $this_lang = LANGUAGE;
    if (file_exists(INFUSIONS . "varcade/locale/" . $this_lang . ".php")) {
        include INFUSIONS . "varcade/locale/" . $this_lang . ".php";
    } else {
Example #28
0
 *   wibix@gmx.de                                                          *
 *   http://wibix.de/                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
if (!defined('IN_FUSION')) {
    die;
}
if (!$download->id) {
    fallback('download.php');
}
if ($download->status == PDP_PRO_NEW) {
    fallback('edit_desc.php?did=' . $download->id);
}
if ($download->status == PDP_PRO_ON) {
    dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tcount_visitors=count_visitors+1\n\t\tWHERE download_id='" . $download->id . "'");
}
// FIXME: THIS IS DONE TOO OFTEN - REDUCE
$is_subscribing = false;
if (iMEMBER && $pdp->settings['allow_notify'] == 'yes') {
    $is_subscribing = $download->is_subscribing($userdata['user_id']);
}
/****************************************************************************
 * GUI
 */
// license
$license = '';
if ($download->data['license_id']) {
Example #29
0
 /**
  * Function: setField
  * Sets the feather's fields for creating/editing posts with that feather.
  *
  * Parameters:
  *     $options - An array of key => val options for the field.
  *
  * Options:
  *     attr - The technical name for the field. Think $post->attr.
  *     type - The field type. (text, file, text_block, or select)
  *     label - The label for the field.
  *     preview - Is this field previewable?
  *     optional - Is this field optional?
  *     bookmarklet - What to fill this field by in the bookmarklet.
  *                   url or page_url - The URL of the page they're viewing when they open the bookmarklet.
  *                   title or page_title - The title of the page they're viewing when they open the bookmarklet.
  *                   selection - Their selection on the page they're viewing when they open the bookmarklet.
  *     extra - Stuff to output after the input field. Can be anything.
  *     note - A minor note to display next to the label text.
  */
 protected function setField($options)
 {
     fallback($options["classes"], array());
     if (isset($options["class"])) {
         $options["classes"][] = $options["class"];
     }
     if (isset($options["preview"]) and $options["preview"]) {
         $options["classes"][] = "preview_me";
     }
     $this->fields[$options["attr"]] = $options;
 }
/****************************************************************************
 * ACTION
 */
if (isset($_POST['really_send'])) {
    $do_pm = true;
    if (!pdp_check_captcha()) {
        fallback(FUSION_SELF . '?did=' . $download->id . '&wrong_captcha=1');
    }
    if ($pdp->settings['broken_count']) {
        $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\t\tSET\n\t\t\tdl_broken_count=dl_broken_count+1\n\t\t\tWHERE download_id='" . $download->id . "'\n\t\t\t\tAND dl_broken_count<" . $pdp->settings['broken_count'] . "");
        $do_pm = mysql_affected_rows();
    }
    if ($do_pm) {
        $download->log_event(PDP_EV_BROKEN, 0);
    }
    fallback(FUSION_SELF . '?did=' . $download->id . '&ok=yes');
}
/****************************************************************************
 * GUI
 */
opentable($locale['PDP140']);
if (isset($_GET['wrong_captcha'])) {
    show_info($locale['pdp_wrong_captcha']);
}
echo '
<div style="text-align:center;">';
if (isset($_GET['ok'])) {
    echo '<p>' . $locale['PDP141'] . '</p>';
} else {
    $text = parseubb(str_replace('%ip', USER_IP, $pdp->settings['broken_text']));
    if (FUSION_VERSION != 'FF') {