Exemple #1
0
function frm($name)
{
    if (form_post("submit")) {
        $message = "";
        foreach ($_REQUEST as $key => $value) {
            if (str_beg($key, "cb_")) {
                $message .= "{$value}\r\n";
            }
            if (str_beg($key, "f_")) {
                $caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
                $message .= "{$caption}:\r\n{$value}\r\n\r\n";
            }
        }
        $from = "no-reply-site-form@" . $_SERVER['HTTP_HOST'];
        $to = setting("admin_email");
        $subject = form_post("subject");
        $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
        if (form_file_uploaded("uploadedfile")) {
            $tmp = $_FILES['uploadedfile']['tmp_name'];
            $fname = $_FILES['uploadedfile']['name'];
            /*           if($local) {
                         die("<pre>$message tmp[$tmp] fname[$fname]</pre>");
            		   } else {*/
            mail_attach($from, $to, $subject, $message, $tmp, $fname);
            //		   }
        } else {
            /*           if($local) {
                         die("<pre>$message</pre>");
            		   } else*/
            mail_from($to, $subject, $message, $from);
        }
        return form_post("success");
    }
    return template("form_email", "content", template("form_email_" . $name));
}
Exemple #2
0
function page_admin_edit($table, $field, $id)
{
    use_layout("admin");
    requires_admin();
    global $tables;
    if (!isset($tables[$table]['liveedit'])) {
        die("can't edit this table tables[{$table}]['liveedit'] not set");
    }
    if (isset($_POST['editor1'])) {
        $html = form_post("editor1");
        $html = str_replace('\\"', '"', $html);
        $html = str_replace("\\'", "'", $html);
        $html = str_replace("\\\\", "\\", $html);
        $f = "on_{$table}_{$field}_update";
        if (function_exists($f)) {
            $f($id, $html);
        }
        db_query("UPDATE %s SET %s='%s' WHERE id=%d", $table, $field, $html, $id);
        if (CLOSE_ON_SAVE) {
            die("<script> window.close();</script>");
        }
        flash("message", "Изменения сохранены");
    }
    $content = db_result(db_query("SELECT %s FROM %s WHERE id=%d", $field, $table, $id));
    $o = "";
    if (form_post("back")) {
        $back = form_post("back");
        $o .= "<a href={$back}><<Назад</a>";
    }
    $o .= template("tinymce", "content", $content);
    return $o;
}
Exemple #3
0
function page_p($id, $edit = true)
{
    if (is_numeric($id)) {
        $page = db_object_get("pages", $id);
    } else {
    }
    if ($page) {
        //file_put_contents("content.txt", $page->content);
        $o = fld_trans($page->content);
        if (function_exists("on_page_content")) {
            on_page_content($o);
        }
    } else {
        $o = "not defined";
    }
    if ($edit) {
        $o .= p_quickedit_html($id);
    }
    replace_my_tags($o);
    // {href {f {call
    if (form_post("die")) {
        replace_files($o);
        // {!something.js} {!something.css}
        replace_globals($o);
        // {!global} {!global}
        translate_parse($o);
        // {~rus} {~eng}
        die($o);
    }
    return $o;
}
Exemple #4
0
function page_admin_edit($table, $field, $id)
{
    use_template("admin");
    requires_admin();
    global $tables;
    if (!isset($tables[$table]['liveedit'])) {
        die("can't edit this table tables[{$table}]['liveedit'] not set");
    }
    if (form_post("editor1")) {
        $html = form_post("editor1");
        $html = str_replace('\\"', '"', $html);
        $html = str_replace("\\'", "'", $html);
        $f = "on_{$table}_{$field}_update";
        if (function_exists($f)) {
            $f($id, $html);
        }
        db_query("UPDATE %s SET %s='%s' WHERE id=%d", $table, $field, $html, $id);
        if (CLOSE_ON_SAVE) {
            die("<script> window.close();</script>");
        }
    }
    $content = db_result(db_query("SELECT %s FROM %s WHERE id=%d", $field, $table, $id));
    $o = template("tinymce", "content", $content);
    return $o;
}
Exemple #5
0
function frm($name, $email = "")
{
    if (form_post("submit")) {
        $message = "";
        foreach ($_REQUEST as $key => $value) {
            if (str_beg($key, "cb_")) {
                $message .= "{$value}\r\n";
            }
            if (str_beg($key, "f_")) {
                $caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
                $message .= "{$caption}\r\n{$value}\r\n\r\n";
            }
        }
        $from = "*****@*****.**";
        if (!$email) {
            $to = setting("admin_email");
        } else {
            $to = $email;
        }
        $subject = form_post("subject");
        $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
        $parts = explode(";", $email);
        if (form_file_uploaded("uploadedfile")) {
            $tmp = $_FILES['uploadedfile']['tmp_name'];
            $fname = $_FILES['uploadedfile']['name'];
            if ($local) {
                echo "<pre>{$message} tmp[{$tmp}] fname[{$fname}]</pre>";
            } else {
                foreach ($parts as $reciever) {
                    mail_attach($from, $reciever, $subject, $message, $tmp, $fname);
                }
            }
        } else {
            if ($local) {
                echo "<pre>{$message}</pre>";
            } else {
                foreach ($parts as $reciever) {
                    mail_from($reciever, $subject, $message, $from);
                }
            }
        }
        return form_post("success");
    }
    return template("frm_" . $name);
}
Exemple #6
0
function page_start($auto = 0)
{
    $o = "";
    $memo = db_result(db_query("SELECT memo FROM log  WHERE active_check ORDER BY id desc LIMIT 1"));
    form_start();
    form_input("memo", "memo", $memo);
    form_submit("submit", "submit");
    $o .= form();
    if (form_post("submit") || $auto) {
        if ($auto) {
            $_REQUEST['memo'] = $memo;
        }
        db_query("INSERT INTO log (time_time,active_check,memo) \r\n\t  VALUES(%d,true,'%s')", time(), form_post("memo"));
        $o .= "<br>submitted";
        redir("report");
    }
    return $o;
}
Exemple #7
0
function page_p($id)
{
    $page = db_object_get("pages", $id);
    if ($page) {
        $o = $page->content;
    } else {
        $o = "not defined";
    }
    $o .= p_quickedit_html($id);
    replace_my_tags($o);
    // {href {f {call
    if (form_post("die")) {
        replace_files($o);
        // {!something.js} {!something.css}
        replace_globals($o);
        // {!global} {!global}
        translate_parse($o);
        // {~rus} {~eng}
        die($o);
    }
    return $o;
}
Exemple #8
0
function table_form_post($table, $answer)
{
    if (form_post($table . "_submit")) {
        direct_post($table);
        if (isset($_REQUEST["message_" . $table])) {
            return $_REQUEST["message_" . $table];
        } else {
            return "Record posted";
        }
    }
    return "";
}
Exemple #9
0
require_once CACTI_BASE_PATH . "/lib/device/device_info.php";
require_once CACTI_BASE_PATH . "/lib/device/device_form.php";
require_once CACTI_BASE_PATH . "/lib/data_source/data_source_update.php";
require_once CACTI_BASE_PATH . "/lib/data_query/data_query_execute.php";
require_once CACTI_BASE_PATH . "/lib/data_query/data_query_info.php";
require_once CACTI_BASE_PATH . "/lib/device_template/device_template_info.php";
require_once CACTI_BASE_PATH . "/lib/package/package_info.php";
require_once CACTI_BASE_PATH . "/lib/graph/graph_update.php";
define("MAX_DISPLAY_PAGES", 21);
/* set default action */
if (!isset($_REQUEST["action"])) {
    $_REQUEST["action"] = "";
}
switch ($_REQUEST["action"]) {
    case 'save':
        form_post();
        break;
    case 'remove_package':
        host_remove_package();
        break;
    case 'query_reload':
        host_reload_query();
        header("Location: devices.php?action=edit&id=" . $_GET["host_id"]);
        break;
    case 'query_verbose':
        host_reload_query();
        header("Location: devices.php?action=edit&id=" . $_GET["host_id"] . "&display_dq_details=true");
        break;
    case 'edit':
        require_once CACTI_BASE_PATH . "/include/top_header.php";
        host_edit();
Exemple #10
0
function page_search_google()
{
    global $base_url;
    Header("Location: http://www.google.com/search?q=" . form_post('s') . "&sitesearch=" . $base_url);
    die;
}
function include_register1_text()
{
    $strHost = $GLOBALS['Host'];
    $strCopyright = $GLOBALS['OrkfiaCopyright'];
    include_once 'inc/classes/clsGame.php';
    $objGame = new clsGame();
    $strTribeSwitch = $objGame->get_game_switch(TRIBE_CREATION);
    $strAllianceSwitch = $objGame->get_game_switch(ALLIANCE_CREATION);
    $strBootcampSwitch = $objGame->get_game_switch(BOOTCAMP_SIGNUPS);
    $link = "main.php?cat=main&amp;page=register1&amp;alliance_type=";
    if (!isset($_GET['alliance_type'])) {
        //======================================================================
        // Signup selection (first part) of registration page
        //======================================================================
        ?>
    <div id="text" style="margin: 15px auto; width: 600px;">

        <h2 style="margin: 15px auto; text-align: center;"><img src="<?php 
        echo $strHost;
        ?>
first_sign_up.gif" alt="ORKFiA Sign Up!" /></h2>

        <h3>Join an Alliance</h3>

        <p>If you have the password of an existing alliance you may join in by
        selecting <em>Join Friends</em>, otherwise <em>Join Random</em> is the
        recommended choice. You can merge any time later if you wish to move
        into another alliance.</p>

<?php 
        if ($strTribeSwitch == ON) {
            echo "<p>| <a href=\"" . $link . "random\">Join Random</a> ";
            echo "| <a href=\"" . $link . "existing\">Join Friends</a> |</p>";
        } else {
            echo "<p><em class=\"positive\">The option to join an alliance has temporarily been disabled.</em></p>";
        }
        ?>

        <h3>Join a Bootcamp</h3>

        <p>Bootcamp leaders will assist you here, answering questions and
        teaching you how to master the game. If you wish to lead or instruct a
        boot camp, contact staff in alliance (#3).</p>
<?php 
        // M: For some reason this stopped working with the new MySQL server
        //         $strSQL = "SELECT kingdom, COUNT(*) as num_players FROM stats GROUP BY kingdom HAVING kingdom IN(SELECT id as kingdom FROM kingdom WHERE bootcamp = 'yes') ORDER BY kingdom DESC";
        //         $resSQL = mysql_query($strSQL);
        $iOpenBootcamps = 0;
        $iSpotsOpen = 0;
        $strSQL = "SELECT id FROM " . TBL_ALLIANCE . " WHERE bootcamp = 'yes' ORDER BY id DESC";
        $resSQL = mysql_query($strSQL);
        while ($arrRES = mysql_fetch_array($resSQL)) {
            $strSQL = "SELECT COUNT(*), " . ALLIANCE . " FROM stats WHERE " . ALLIANCE . " = {$arrRES[ID]} GROUP BY " . ALLIANCE . " ORDER BY " . ALLIANCE . " DESC";
            $resSQL2 = mysql_query($strSQL);
            $arrRES2 = mysql_fetch_row($resSQL2);
            if ($arrRES2[0] < MAX_ALLIANCE_SIZE) {
                $iOpenBootcamps++;
                $iLowestAlliNr = $arrRES2[1];
                $iSpotsOpen = MAX_ALLIANCE_SIZE - $arrRES2[0];
            }
        }
        //         $iOpenBootcamps = 0;
        //         while ($arrRES = mysql_fetch_array($resSQL))
        //         {
        //             if ($arrRES['num_players'] < MAX_ALLIANCE_SIZE)
        //             {
        //                 $iOpenBootcamps++;
        //                 $iLowestAlliNr = $arrRES['kingdom'];
        //                 $iSpotsOpen = MAX_ALLIANCE_SIZE - $arrRES['num_players'];
        //             }
        //         }
        if ($strBootcampSwitch == OFF) {
            ?>
        <p><em class="positive">The option to join a bootcamp has temporarily been disabled.</em></p>
<?php 
        } elseif ($iOpenBootcamps == 0) {
            ?>
        <p><em class="positive">Sorry, currently there are no bootcamps available.</em></p>
<?php 
        } else {
            ?>
        <p>| <a href="<?php 
            echo $link;
            ?>
random&amp;bootcamp=yes">Join Bootcamp</a> | <em>Bootcamp (#<?php 
            echo $iLowestAlliNr;
            ?>
) accepts <?php 
            echo $iSpotsOpen;
            ?>
 more tribes</em></p>
<?php 
        }
        ?>
        <h3>Create an Alliance</h3>

        <p>Recommended if you plan on joining with more than 5 other players as
        the world of Orkfia is a very competitive place. Small alliances tend
        not to lead to greatness.</p>

        <p>

<?php 
        $iEmptyAllianceId = check_empty_alliances();
        if ($strAllianceSwitch == ON && $strTribeSwitch == ON && $iEmptyAllianceId > 0) {
            echo "| <a href=\"" . $link . "new\">Create an Alliance</a> |" . " <em>Alliance (#{$iEmptyAllianceId}) is available</em>";
        } elseif ($iEmptyAllianceId == 0) {
            echo '<em class="positive">Sorry, the option to create an alliance is currently unavailable. (Maximum of ' . MAX_ALLIANCES . ' alliances reached)</em>';
        } else {
            echo '<em class="positive">Alliance creation has temporarily been disabled.</em>';
        }
        ?>

        </p>
    </div>

    <div class="center" style="font-size: 0.8em"><?php 
        echo $strCopyright;
        ?>
</div>

<?php 
    } else {
        //======================================================================
        // Form fields of registration page
        //======================================================================
        ?>

    <div id="text" style="margin: 15px auto; width: 600px;">
        <h2 style="margin: 15px auto; text-align: center;"><img src="<? echo $strHost; ?>first_sign_up.gif" alt="ORKFiA Sign Up!" /></h2>

<?php 
        if (isset($_GET['bootcamp']) && $_GET['bootcamp'] == 'yes') {
            $bootcamp = $_GET['bootcamp'];
        } else {
            $bootcamp = 'no';
        }
        // Validate alliance type input on creation
        $iEmptyAllianceId = check_empty_alliances();
        $strAllianceType = strval($_GET['alliance_type']);
        if ($strAllianceType == 'new' && ($strAllianceSwitch == OFF || $iEmptyAllianceId == 0 || $bootcamp == 'yes')) {
            $strAllianceType = 'random';
        }
        form_head($strAllianceType);
        switch ($strAllianceType) {
            case "random":
                echo "<input type=\"hidden\" value=\"{$bootcamp}\" name=\"register[bootcamp]\" />";
                break;
            case "existing":
                form_join_friends();
                // join existing
                break;
            case "new":
                form_create_alliance();
                // create alliance
                break;
        }
        form_login_info();
        form_tribe_info();
        form_agreement();
        form_random();
        form_post();
        ?>

        </div>

<?php 
    }
}
Exemple #12
0
function page_admin_catalog_edit($parent_id = "", $act = "", $id = "")
{
    requires_admin();
    use_template("admin");
    if (!$parent_id) {
        $parent_id = 0;
    }
    $o = "";
    if ($act == "del") {
        $rec = db_object_get("catalog", $id);
        if ($rec->fixed == 'Y') {
            $act = "-";
            $o .= '<script>alert("Эту запись нельзя удалить.")</script>';
        }
    }
    global $tables;
    $tables['catalog']['fields'][] = "title";
    $tables['catalog']['fields'][] = "price";
    $tables['catalog']['fields'][] = "count";
    $tables['catalog']['fields'][] = "articul";
    $tables['catalog']['weight'] = true;
    $o .= catalog_admin_path($parent_id);
    if (form_file_uploaded("file")) {
        $fname = $_FILES["file"]['name'];
        $ext = strtolower(fileext($fname));
        if (!($ext == "swf" || $ext == "jpg" || $ext == "gif" || $ext == "png" || $ext == "bmp" || $ext == "jpeg" || $ext == "pdf")) {
            $o = "Данный тип файла не является картинкой";
            return $o;
        } else {
            @unlink("img/upload/catalog/" . db_result(db_query("SELECT image_file FROM catalog WHERE id=%d", $id)));
            $fname = $id . "." . fileext($fname);
            form_file_uploaded_move("file", "img/upload/catalog/" . $fname);
            db_query("UPDATE catalog SET image_file='{$fname}' WHERE id=%d", $id);
            //redir("admin/images");
        }
    }
    if (form_post("edit")) {
        search_table_update("catalog", $id, "title", $_REQUEST['title']);
    }
    if ($act == "del") {
        search_table_delete("catalog", $id);
    }
    global $table_edit_props;
    $table_edit_props->add_redir = false;
    $o .= table_edit("catalog", "admin/catalog/edit/{$parent_id}", $act, $id, "parent_id", $parent_id, "", "on_catalog");
    if (form_post("add")) {
        search_table_update("catalog", db_last_id(), "title", $_REQUEST['title']);
        redir("admin/catalog/edit/{$parent_id}");
    }
    if ($act == "edit" && catalog_item_level($id) == 2) {
        $o .= "<a class=admin_menu target=_blank href=catalog/view/{$id}>Просмотр на сайте</a>&nbsp;<br>";
        $o .= "<a href=admin/edit/catalog/description/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Описание</a>&nbsp;";
        $o .= "<a href=admin/edit/catalog/overview/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Overview</a>&nbsp;";
        $o .= "<a href=admin/edit/catalog/specifications/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Specifications</a>&nbsp;";
        $o .= "<a href=admin/edit/catalog/download/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Download</a>&nbsp;";
        $o .= "<a href=admin/edit/catalog/support/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Support</a>&nbsp;";
        $o .= "<a href=admin/edit/catalog/related/{$id}&back=admin/catalog/edit/{$parent_id}/edit/{$id} class=admin_menu>Related Products</a>&nbsp;<br>";
        $o .= "<a href=admin/catalog/images/{$id} class=admin_menu>Изображения</a><br>";
        $rr = db_fetch_objects(db_query("SELECT * FROM catalog_images WHERE catalog_id={$id} ORDER BY weight"));
        foreach ($rr as $r) {
            $o .= "<img width=200px src=img/upload/catalog/{$r->image_file}>";
        }
    }
    if ($act == "add" && catalog_item_level($parent_id) == 1) {
        $o .= "Изображение можно будет загрузить после добавления товара.";
    }
    $o .= "<script>\r\n\$(function() {\r\n  \$('input[name=title]').css('width','400px');\r\n\r\n});\r\n\r\n\t</script>";
    return $o;
}
Exemple #13
0
function page_m($id)
{
    $m = db_object_get("menu", $id);
    if (!$m->link) {
        $o = "Меню - пустая ссылка";
        if (!form_post('die')) {
            return $o;
        } else {
            echo $o;
            die;
        }
    }
    Header("Location: {$m->link}");
    die;
}
    ?>
" size="50" /></td>
        </tr>
        
        <tr valign="top">
        <th>Twitter+ (Insert URL):<br /></th>
        <td><input type="text" name="twitter" value="<?php 
    echo form_post("twitter");
    ?>
" size="50" /></td>
        </tr>
        
        <tr valign="top">
        <th>Facebook (Insert URL): <br /></th>
        <td><input type="text" name="facebook" value="<?php 
    echo form_post("facebook");
    ?>
" size="50" /></td>
        </tr>
        
        
        
    </table>    

         <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Add Consultant"></p>
                
       </form>
    
      <?php 
}
?>
Exemple #15
0
<?php

define("DEFAULT_LANG", "orig");
if (!isset($lang_dir)) {
    $GLOBALS['lang_dir'] = "";
}
function lang_is($lang)
{
    return $GLOBALS['lang_dir'] == "{$lang}/" || $GLOBALS['lang_dir'] == $lang;
}
if (form_post("lang")) {
    $lang_dir = form_post("lang") . "/";
}
function set_lang($value)
{
    global $apptitle;
    $_SESSION[$apptitle . 'lang'] = $value;
}
function page_lang($value)
{
    global $apptitle;
    $_SESSION[$apptitle . 'lang'] = $value;
    if (isset($_SERVER['HTTP_REFERER'])) {
        Header("Location: " . $_SERVER['HTTP_REFERER']);
    } else {
        die;
    }
}
function page_rus()
{
    return page_lang("rus");
Exemple #16
0
require_once "bios.php";
//all functions
require_once "conf.php";
if (function_exists("data_model")) {
    data_model();
}
db_connect();
error_reporting(E_ALL | E_STRICT);
if (!isset($_SESSION['lang'])) {
    $_SESSION['lang'] = 'eng';
}
global $submenu;
global $pageheader;
global $log;
global $content;
$query = form_post('q');
$submenu = "";
$log = "";
$content = "";
$pageheader = "";
//OTHER MODULES
$modules = array();
foreach (glob("uses/*.php") as $module) {
    require_once $module;
    $module_name = str_replace("uses/", "", str_replace(".php", "", $module));
    $modules[] = $module_name;
    $fname = $module_name . "_connect";
    if (function_exists($fname)) {
        $fname();
    }
}
Exemple #17
0
function page_admin_settings()
{
    requires_admin();
    use_layout("admin");
    global $tables;
    $o = "";
    if (form_post("save")) {
        $set = "";
        foreach ($tables['settings']['fields'] as $field) {
            if ($set) {
                $set .= ",";
            }
            $set = "{$field}='" . form_post($field) . "'";
        }
        db_query("UPDATE settings SET {$set}");
        $o .= "<font color=green>changes saved</font>";
    }
    $vals = db_fetch_object(db_query("SELECT * FROM settings LIMIT 1"));
    form_start();
    foreach ($tables['settings']['fields'] as $field) {
        form_input($field, $field, $vals->{$field});
    }
    form_submit("Save", "save");
    form_end();
    $o .= form();
    return $o;
}
Exemple #18
0
foreach (glob("uses/*.php") as $module) {
    require_once $module;
    $module_name = str_replace("uses/", "", str_replace(".php", "", $module));
    $modules[] = $module_name;
    $fname = $module_name . "_connect";
    if (function_exists($fname)) {
        $fname();
    }
}
if (form_post("l")) {
    if (form_post("l") == "rus") {
        $_SESSION['lang'] = "rus";
    } else {
        $_SESSION['lang'] = "eng";
    }
    redir(form_post('q'));
}
if ($_SESSION['lang'] == 'rus') {
    $rus_highlight = "#C0BEBF";
    $eng_highlight = "#515151";
} else {
    $rus_highlight = "#515151";
    $eng_highlight = "#C0BEBF";
}
//LOGIN - different menus generation for different user's
$menu_logout = "";
$menu_user = "";
$menu_users = "";
if (user_authorized() && $_SESSION['userid'] == 1) {
    $menu_users = ":: <a href=?q=users>Users</a>";
}