Beispiel #1
0
 public function __construct($id)
 {
     parent::__construct($id);
     if ($this->type != "MT") {
         throw new Exception("not a MT engine");
     }
 }
Beispiel #2
0
 static function getInstance()
 {
     if (is_null(engine::$instance)) {
         engine::$instance = new engine();
     }
     return engine::$instance;
 }
Beispiel #3
0
 static function getInstance($option = '')
 {
     if (is_null(engine::$instance)) {
         $instance = new engine($option);
         engine::$instance = $instance;
     }
     return engine::$instance;
 }
Beispiel #4
0
 public function finalize()
 {
     $engine = engine::getInstance();
     if ($this->command) {
         header('Content-Type: text/xml');
         //      header('Content-length: '.strlen
     }
     $engine->setResult($this->html);
 }
 protected static function fetchPreviews($count = 3)
 {
     $query = sprintf("SELECT * FROM nodes_catalog WHERE visible = 1 LIMIT %s OFFSET 0", $count);
     $result = engine::mysql($query);
     $return = [];
     while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $return[] = $data;
     }
     return $return;
 }
Beispiel #6
0
 public function process_actions()
 {
     $redirect = null;
     foreach ($this->actions as $type => $actions) {
         if ($type == 'redirect') {
             $redirect = array_pop($actions);
         }
     }
     if ($redirect !== null) {
         $redirect = 'http://' . def::site('domain') . (empty($redirect) ? $_SERVER["REQUEST_URI"] : $redirect);
         engine::redirect($redirect);
     }
 }
 function main_class($site)
 {
     $this->site = $site;
     $this->engine = $this->site->engine;
     if (!empty($site->get[0])) {
         $site->content = engine::error();
         return;
     }
     $this->site->content = $this->render('main/gallery.php', ['img_list' => GalleryService::custom_get_image_paths(10)]);
     $this->site->content .= $this->render('main/text.php');
     $this->site->content .= $this->render('main/preview.php', ['previews' => PreviewService::getPreviews()]);
     $this->site->content .= $this->render('main/signup.php');
 }
 private function getProductsFormDb($page, $perPage, array $whereConditions = [])
 {
     $results = [];
     $whereConditionString = '';
     if (!empty($whereConditions)) {
         $whereConditionString = 'WHERE ';
         foreach ($whereConditions as $key => $value) {
             $whereConditionString .= strtr(json_encode($whereConditions), ['{' => '', '}' => '', ':' => '=', ',' => ' AND ', '"' => '']);
         }
     }
     $query = sprintf("SELECT * FROM products %s LIMIT %s OFFSET %s", $whereConditionString, $perPage, $perPage * $page);
     $query_result = engine::mysql($query);
     while ($data = mysql_fetch_array($query_result)) {
         $results[] = $data;
     }
     return $results;
 }
 function search_class($site)
 {
     $this->site = $site;
     $this->engine = $this->site->engine;
     if (!empty($site->get[3])) {
         $site->content = engine::error();
         return;
     }
     $urls = array();
     $site->title = urldecode($site->get[1]) . ' - ' . $site->title;
     $site->content .= $GLOBALS["Lang"]["Search results by request"] . '<br/><br/><h1> "' . urldecode($site->get[1]) . '"</h1><br/><br/>';
     $query = 'SELECT * FROM `nodes_content` WHERE `text` LIKE "%' . urldecode($site->get[1]) . '%"';
     $res = engine::mysql($query);
     while ($data = mysql_fetch_array($res)) {
         require_once "engine/functions/print_preview.php";
         $site->content .= print_preview($data);
         array_push($urls, "/" . $data["url"]);
     }
 }
Beispiel #10
0
 public function finalize()
 {
     $template = template::getInstance();
     $this->html = $template->get('index');
     $html = $this->html;
     if (!is_null($this->content)) {
         $this->content->finalize();
         //      $html = $this->content->display();
     }
     $html = $template->updateLang($html);
     $html = str_replace('EXEC_TIME', microtime(true) - EXEC_TIME, $html);
     $html = str_replace('APP_NAME', APP_NAME, $html);
     $html = str_replace('APP_VERSION', APP_VERSION, $html);
     $html = str_replace('APP_BUILD', APP_BUILD, $html);
     $html = str_replace('APP_AUTHOR', APP_AUTHOR, $html);
     unset($this->module);
     $this->module = null;
     $engine = engine::getInstance();
     $engine->setResult($html);
 }
function refresh_catch($jQuery = 0)
{
    $html = engine::curl_post_query($_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_URI"], "nocatch=1");
    $c = explode('<!DOCTYPE', $html);
    preg_match('/<title>(.*?)<\\/title>.*?<\\!-- content -->(.*?)<\\!-- \\/content -->/sim', $html, $m);
    $title = trim($m[1]);
    $content = trim($m[2]);
    if (!empty($content)) {
        $fout = '<!DOCTYPE' . str_replace('<content/>', $content, $c[1]);
    } else {
        $fout = '<!DOCTYPE' . $c[1];
    }
    $query = 'UPDATE `nodes_catch` SET `html` = "' . str_replace('"', '\\"', $html) . '", `date` = "' . date("U") . '", `title` = "' . $title . '", `content` = "' . str_replace('"', '\\"', trim($content)) . '" WHERE `url` = "' . $_SERVER["SCRIPT_URI"] . '"';
    engine::mysql($query);
    if (!$jQuery) {
        die($fout . "\n<!-- Refreshing catch. Time loading: " . (microtime() - $GLOBALS["time"]) . " -->");
    } else {
        die($content . "\n<!-- Refreshing catch and return content. Time loading: " . (microtime() - $GLOBALS["time"]) . " -->");
    }
}
Beispiel #12
0
 /**
  * Checks if the schema existing fields are properly set, triggers an exception otherwise.
  *
  * @throws \moodle_exception
  * @param array $fields
  * @param bool $requireexisting Require the fields to exist, otherwise exception.
  * @return void
  */
 protected function validate_fields(&$fields, $requireexisting = false)
 {
     global $CFG;
     foreach ($fields as $fieldname => $data) {
         $url = $this->engine->get_connection_url('/schema/fields/' . $fieldname);
         $results = $this->curl->get($url);
         if ($this->curl->error) {
             throw new \moodle_exception('errorcreatingschema', 'search_solr', '', $this->curl->error);
         }
         if (!$results) {
             throw new \moodle_exception('errorcreatingschema', 'search_solr', '', get_string('nodatafromserver', 'search_solr'));
         }
         $results = json_decode($results);
         if ($requireexisting && !empty($results->error) && $results->error->code === 404) {
             $a = new \stdClass();
             $a->fieldname = $fieldname;
             $a->setupurl = $CFG->wwwroot . '/search/engine/solr/setup_schema.php';
             throw new \moodle_exception('errorvalidatingschema', 'search_solr', '', $a);
         }
         // The field should not exist so we only accept 404 errors.
         if (empty($results->error) || !empty($results->error) && $results->error->code !== 404) {
             if (!empty($results->error)) {
                 throw new \moodle_exception('errorcreatingschema', 'search_solr', '', $results->error->msg);
             } else {
                 // All these field attributes are set when fields are added through this script and should
                 // be returned and match the defined field's values.
                 if (empty($results->field) || !isset($results->field->type) || !isset($results->field->multiValued) || !isset($results->field->indexed) || !isset($results->field->stored)) {
                     throw new \moodle_exception('errorcreatingschema', 'search_solr', '', get_string('schemafieldautocreated', 'search_solr', $fieldname));
                 } else {
                     if ($results->field->type !== $data['type'] && ($data['type'] !== 'text' || $results->field->type !== 'text_general') || $results->field->multiValued !== false || $results->field->indexed !== $data['indexed'] || $results->field->stored !== $data['stored']) {
                         throw new \moodle_exception('errorcreatingschema', 'search_solr', '', get_string('schemafieldautocreated', 'search_solr', $fieldname));
                     } else {
                         // The field already exists and it is properly defined, no need to create it.
                         unset($fields[$fieldname]);
                     }
                 }
             }
         }
     }
 }
            * 
            */
            header('location: /account/finances');
            die('<script>window.location = "/account/finances";</script>');
        } else {
            if ($_GET["mode"] == "cancel") {
                if (!$test) {
                    $query = 'UPDATE `nodes_transactions` SET `status` = "-1" WHERE `id` = "' . $payment->getId() . '"';
                } else {
                    $query = 'UPDATE `nodes_transactions` SET `status` = "-1" WHERE `id` = "' . $_REQUEST["id"] . '"';
                }
                $_SESSION["payment_id"] = '';
                engine::mysql($query);
                header('location: /account/finances');
                die('<script>window.location = "/account/finances";</script>');
            } else {
                if (!$test) {
                    $query = 'UPDATE `nodes_transactions` SET `status` = "-1" WHERE `id` = "' . $payment->getId() . '"';
                } else {
                    $query = 'UPDATE `nodes_transactions` SET `status` = "-1" WHERE `id` = "' . $_REQUEST["id"] . '"';
                }
                $_SESSION["payment_id"] = '';
                engine::mysql($query);
                header('location: /account/finances');
                die('<script>window.location = "/account/finances";</script>');
            }
        }
    }
} else {
    engine::error();
}
 /**
  * Setup for the languageConf class.
  * tell Translation2 about our db-tables structure,
  * setup primary language
  * setup the group of module strings we want to fetch from
  * add a Lang decorator to provide a fallback language
  * add another Lang decorator to provide another fallback language,
  * in case some strings are not translated in all languages that exist in KINKY
  *
  * @param void
  * @return void
  * @access public
  */
 public function setup()
 {
     try {
         $otherLangs = $this->dblangAvail->getLanguageList();
         $entries = array();
         $entries['en'] = TABLE_PREFIX . 'en';
         foreach ($otherLangs as $lang) {
             $id = $lang['id'];
             $entries[$id] = TABLE_PREFIX . $id;
         }
         //Define table properties so that MDB2 knows about them
         $params = array('langs_avail_table' => TABLE_PREFIX . 'langs_avail', 'lang_id_col' => 'id', 'lang_name_col' => 'name', 'lang_meta_col' => 'meta', 'lang_errmsg_col' => 'error_text', 'strings_tables' => $entries, 'string_id_col' => 'id', 'string_page_id_col' => 'pageID', 'string_text_col' => '%s');
         $driver = 'MDB2';
         //instantiate class
         $this->_siteConf = $this->getObject('altconfig', 'config');
         $langcache = $this->_siteConf->getlangcache();
         if (strtolower($langcache) === 'true') {
             $langcache = true;
         } else {
             $langcache = false;
         }
         //$dsn = $this->_parseDSN(KEWL_DB_DSN);
         $dsn = engine::parseDSN_(KEWL_DB_DSN);
         $this->lang =& Translation2::factory($driver, $dsn, $params);
         if (PEAR::isError($this->lang)) {
             echo '!';
             throw new customException($this->lang->getMessage());
         }
         $this->langAdmin =& Translation2_Admin::factory($driver, $dsn, $params);
         // caching
         $this->lang =& $this->lang->getDecorator('CacheMemory');
         $this->lang->setOption('prefetch', true);
         //$this->lang =& $this->lang->getDecorator('CacheLiteFunction');
         // TODO: make the caching configuration options for language items configurable
         $cacheLiteOptions = array('memoryCaching' => false, 'cacheDir' => '/tmp/', 'caching' => $langcache, 'lifeTime' => 3600, 'cleaningFrequency' => 0);
         //$this->lang->setOptions($cacheLiteOptions);
         // charsets
         $this->lang =& $this->lang->getDecorator('SpecialChars');
         // control the charset to use
         $this->lang->setOption('charset', 'UTF-8');
         // add a UTF-8 decorator to automatically decode UTF-8 strings
         $this->lang =& $this->lang->getDecorator('UTF8');
         // add a default text decorator to deal with empty strings
         $this->lang =& $this->lang->getDecorator('DefaultText');
         //default value is true
         if (PEAR::isError($this->lang)) {
             throw new customException($this->lang->getMessage());
         }
         if (!is_object($this->lang)) {
             throw new customException('Translation class not loaded');
         }
         // set primary language
         $this->lang->setLang("en");
         // set the group of strings you want to fetch from
         $this->caller = $this->getParam('module');
         if ($this->caller == '') {
             $page = 'system';
         } else {
             $page = $this->caller;
         }
         // This needs to be dynamic, coming from the module that we are using currently
         $this->lang->setPageID($page);
         // add a Lang decorator to provide a fallback language
         $this->lang =& $this->lang->getDecorator('Lang');
         $this->lang->setOption('fallbackLang', 'en');
         /* $this->lang->setOption('cacheDir', '/var/www/cache/');
            $this->lang->setOption('lifeTime', 86400);
            $this->lang->setOption('cleaningFrequency', 0); */
         // replace the empty string with its stringID
         return $this->lang;
         //}
     } catch (Exception $e) {
         // Alterations by jsc on advice from paulscott
         //$this->errorCallback ('Caught exception: '.$e->getMessage());
         echo $e->getMessage();
         exit;
     }
 }
Beispiel #15
0
<?php

/* Load the engine's code */
$__loader = array('log', 'classloader', 'version', 'game', 'tick', 'config', 'db_connection', 'db_accessor', 'db', 'library', 'actions', 'data_tree', 'input', 'ajax', 'handler', 'engine', 'resource', 'tracking', 'session', 'account', 'prefs', 'output');
require_once "../scripts/loader.inc";
/* Identify game version, requested page and engine type, then read request
 * data */
list($sitePath, $page, $eType) = input::identify();
$input = input::read();
/* Load page handler */
handler::load();
/* Load the engine */
engine::load();
/* Connect to the DB */
dbConnect();
/* Set up tracking cookie */
tracking::init();
/* Handle requests */
handleInput();
     if (!empty($user_data->name) && !empty($user_data->screen_name)) {
         if (!empty($_SESSION["user"]["email"])) {
             $query = 'UPDATE `nodes_users` SET `url` = "' . $link . '" WHERE `email` = "' . $_SESSION["user"]["email"] . '"';
             engine::myqsl($query);
             $query = 'SELECT * FROM `nodes_users` WHERE `email` = "' . $_SESSION["user"]["email"] . '"';
             $res = engine::mysql($query);
             $data = mysql_fetch_array($res);
         } else {
             $query = 'SELECT * FROM `nodes_users` WHERE `url` = "' . $link . '"';
             $res = engine::mysql($query);
             $data = mysql_fetch_array($res);
             if (empty($data)) {
                 $query = 'INSERT INTO `nodes_users`(name, photo, url, online) VALUES("' . $user_data->name . '", "' . $user_data->profile_image_url . '", "' . $link . '", "' . date("U") . '")';
                 $res = engine::mysql($query);
                 $query = 'SELECT * FROM `nodes_users` WHERE `url` = "' . $link . '"';
                 $res = engine::mysql($query);
                 $data = mysql_fetch_array($res);
             }
         }
         unset($data["pass"]);
         unset($data[5]);
         unset($data["token"]);
         unset($data[9]);
         $_SESSION["user"] = array();
         $_SESSION["user"] = $data;
         die('<script>parent.window.location = "/account/settings";</script>');
     } else {
         die('<script>alert("Authentication error"); parent.window.location = "/";</script>');
     }
 } else {
     $_SESSION["request"] = '';
    function print_usimg_page()
    {
        $this->caption = $GLOBALS["Lang"]["Images"];
        if (!empty($_POST["file"])) {
            $file = $_POST["file"];
            $caption1 = $_POST["caption"];
            $query = 'INSERT INTO `nodes_img`(name, caption, date) VALUES("' . $file . '", "' . $caption1 . '", "' . date("U") . '")';
            engine::mysql($query);
            $query = 'SELECT * FROM `nodes_img` WHERE `name` = "' . $file . '" AND `caption` = "' . $caption1 . '" ORDER BY `id` DESC LIMIT 0, 1';
            $fres = engine::mysql($query);
            $fimg = mysql_fetch_array($fres);
            array_push($imgs, $fimg["id"]);
        }
        for ($i = 1; $i < 6; $i++) {
            if (!empty($_POST["file" . $i])) {
                $file = $_POST["file" . $i];
                $caption1 = $_POST["caption" . $i];
                $query = 'INSERT INTO `nodes_img`(name, caption, date) VALUES("' . $file . '", "' . $caption1 . '", "' . date("U") . '")';
                engine::mysql($query);
                $query = 'SELECT * FROM `nodes_img` WHERE `name` = "' . $file . '" AND `caption` = "' . $caption1 . '" ORDER BY `id` DESC LIMIT 0, 1';
                $fres = engine::mysql($query);
                $fimg = mysql_fetch_array($fres);
                array_push($imgs, $fimg["id"]);
            }
        }
        if (!empty($_GET["num"])) {
            $query = 'SELECT * FROM `nodes_img` WHERE `id` = "' . htmlspecialchars($_GET["num"]) . '"';
            $res = engine::mysql($query);
            $data = mysql_fetch_array($res);
            $images = "/img/data/big/" . $data['name'];
            if (is_file($images)) {
                @unlink($images);
            }
            $images = "/img/data/thumb/" . $data['name'];
            if (is_file($images)) {
                @unlink($images);
            }
            $query = 'DELETE FROM `nodes_img` WHERE `id` = "' . htmlspecialchars($_GET["num"]) . '"';
            $result = engine::mysql($query) or die;
        }
        $p = 0;
        if (!empty($_GET["page"])) {
            $p = intval(trim(str_replace("\$", "", $_GET["page"])));
        }
        $query = 'SELECT * FROM `nodes_img` ORDER BY `id` DESC LIMIT ' . $p * 18 . ', 18';
        $res = engine::mysql($query);
        $fout = '
    <table width=650 cellpadding=0 cellspacing=10 height=100%>
    <tr>
            ';
        $i = 0;
        while ($data = mysql_fetch_array($res)) {
            $i++;
            if ($i > 6) {
                $i = 1;
                $fout .= '</tr><tr>';
            }
            $fout .= '<td width=100 style="border: #c0c0c0 1px solid; border-radius: 3px; background: #fefefe;" align=center valign=middle><a href="/img/data/big/' . $data["name"] . '">' . '<img src="/img/data/thumb/' . $data["name"] . '" alt="' . $data["caption"] . '" title="' . $data["caption"] . '" style="border-bottom: #c0c0c0 1px solid; max-width: 100px; max-height: 100px;"></a><br/>' . '<div style="margin-top:-3px; padding: 3px;">' . $data["caption"] . ' <div style="float:right;"><a href="/admin/mode=usimg&num=' . $data["id"] . '"><img src="/img/cms/close_button.png" width=12></a></div></div></td>';
        }
        while (++$i < 7) {
            $fout .= '<td>&nbsp;</td>';
        }
        $fout .= '
    </tr>
    <tr>
<td colspan=6>';
        $query = 'SELECT COUNT(*) FROM `nodes_img`';
        $res = engine::mysql($query);
        $d = mysql_fetch_array($res);
        $fout .= '<div style="width: 550px; border: 0px solid; text-align: center; float: left; padding-top: 10px; padding-bottom: 10px;">';
        if ($p > 0) {
            if ($p > 1) {
                $fout .= '<a href="/admin/mode=usimg&page=' . ($p - 1) . '">&lt; ' . $GLOBALS["Lang"]["Previous page"] . '</a>';
            } else {
                $fout .= '<a href="/admin/mode=usimg">&lt; ' . $GLOBALS["Lang"]["Previous page"] . '</a>';
            }
        }
        if (($p + 1) * 18 < intval($d[0])) {
            if ($p > 0) {
                $fout .= ' | ';
            }
            $fout .= '<a href="/admin/mode=usimg&page=' . ($p + 1) . '">' . $GLOBALS["Lang"]["Next page"] . ' &gt;</a>';
        }
        $fout .= '</div>';
        $fout .= '
</td>
    </tr>
    <tr>
        <td colspan=6>
        <form method="POST">';
        $uploading_count = 6;
        require_once "engine/functions/print_uploader.php";
        $fout .= print_uploder();
        $fout .= '
            <div style="clear:both;"></div>
            <input type="submit" value="' . $GLOBALS["Lang"]["Save uploaded images"] . '" class="btn" style="width:200px;">
            </form>
        </td>
    </tr>
    </table>
            ';
        return $fout;
    }
    function account_class($site)
    {
        $this->site = $site;
        $this->engine = $this->site->engine;
        if (!empty($site->get[3])) {
            $site->content = engine::error();
            return;
        }
        if (!empty($_SESSION["user"]["id"])) {
            if (!empty($site->get[1])) {
                if ($site->get[1] == "settings") {
                    if (!empty($_POST["name"])) {
                        $name = mysql_real_escape_string($_POST["name"]);
                        $email = strtolower(mysql_real_escape_string($_POST["email"]));
                        $query = 'UPDATE `nodes_users` SET `name` = "' . $name . '", `email` = "' . $email . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                        engine::mysql($query);
                        $_SESSION["user"]["name"] = $name;
                        $_SESSION["user"]["email"] = $email;
                        if (!empty($_FILES["img"]["tmp_name"])) {
                            $file = engine::upload_photo("img", "img/pic", 50, 50);
                            if ($file != "error") {
                                $file = "/img/pic/" . $file;
                                $query = 'UPDATE `nodes_users` SET `photo` = "' . $file . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                                engine::mysql($query);
                                $_SESSION["user"]["photo"] = $file;
                            }
                        }
                    }
                    if (!empty($_POST["pass"])) {
                        $password = md5(trim($_POST["pass"]));
                        $query = 'UPDATE `nodes_users` SET `pass` = "' . $password . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                        engine::mysql($query);
                    }
                    $site->title = $GLOBALS["Lang"]["Settings"] . ' - ' . $site->title;
                    $site->content = '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["Settings"] . '</h1>';
                    if (empty($_SESSION["user"]["email"])) {
                        $site->content .= '<p>' . $GLOBALS["Lang"]["Enter your email and password to continue"] . '</p>';
                    }
                    $site->content .= '<br/><form method="POST" enctype="multipart/form-data">
                        <div style="width: 300px; margin:auto; text-align:center;">
                        <table>
                        <tr>
                            <td style="padding-bottom: 10px; width: 70px;padding-right: 5px;" align=right><img src="' . $_SESSION["user"]["photo"] . '" width=50  style="border: #d0d0d0 4px solid; border-radius: 4px;  margin-top: -5px;" /></td>
                            <td style="padding-bottom: 0px;" valign=top><div style="float:left; text-align:left; padding-left: 5px;">' . $GLOBALS["Lang"]["Change picture"] . ':<br/><input type="file" name="img" class="input" style="width: 200px;margin-top: 5px;" /></div></td>
                        </tr>
                        
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Name"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="text" name="name" value="' . $_SESSION["user"]["name"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    if (!empty($_SESSION["user"]["email"])) {
                        $site->content .= '
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Email"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="text" name="email" value="' . $_SESSION["user"]["email"] . '" class="input" style="width: 200px;" /></td>
                        </tr>
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Password"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="password" name="pass" value="" placeHolder="' . $GLOBALS["Lang"]["New password"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    } else {
                        $site->content .= '
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Email"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input required type="text" name="email" placeHolder="' . $GLOBALS["Lang"]["Enter your email"] . '" class="input" style="width: 200px;" /></td>
                        </tr>
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Password"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input required type="password" name="pass" value="" placeHolder="' . $GLOBALS["Lang"]["Enter your password"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    }
                    $site->content .= '
<tr>
';
                    if (empty($_SESSION["user"]["url"])) {
                        $site->content .= '<td colspan=2 style="padding: 5px;">';
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "vk_id"';
                        $res = engine::mysql($query);
                        $vk = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "fb_id"';
                        $res = engine::mysql($query);
                        $fb_id = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "tw_key"';
                        $res = engine::mysql($query);
                        $tw_key = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "gp_id"';
                        $res = engine::mysql($query);
                        $gp_id = mysql_fetch_array($res);
                        if (!empty($fb_id["value"]) || !empty($tw_key["value"]) || !empty($gp_id["value"]) || !empty($vk["value"])) {
                            $site->content .= '<div style="padding: 5px; border: #eee 1px solid; border-radius: 5px;">Connect with social network<br/><br/>';
                            if (!empty($fb_id["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href=\'https://www.facebook.com/dialog/oauth?client_id=' . $fb_id["value"] . '&redirect_uri=' . urlencode("http://" . $_SERVER["HTTP_HOST"] . "/account.php?mode=social&method=fb") . '\' style="margin: 15px; margin-left: 0px; cursor: pointer;"><img src="/img/social/fb.png" title="Facebook"/></a>';
                            }
                            if (!empty($tw_key["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="http://' . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=tw" style="margin: 15px;"><img src="/img/social/tw.png" title="Twitter"/></a>';
                            }
                            if (!empty($gp_id["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="http://' . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=gp" style="margin: 15px;"><img src="/img/social/gp.png" title="Google+"/></a>';
                            }
                            if (!empty($vk["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="https://oauth.vk.com/authorize?client_id=' . $vk["value"] . '&scope=notify&redirect_uri=' . urlencode("http://" . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=vk') . '&display=page&response_type=token" style="margin: 15px; margin-right: 0px;"><img src="/img/social/vk.png" title="VK"/></a>';
                            }
                            $site->content .= '</div>';
                        }
                    } else {
                        $site->content .= ' <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Site"] . ':</td>
                            <td align=left style="padding-left: 7px;"><div style="overflow:hidden; height: 14px; width: 200px;"><a href="' . $_SESSION["user"]["url"] . '" target="_blank">' . str_replace('/', ' / ', str_replace("http://", '', $_SESSION["user"]["url"])) . '</a></div><br/>';
                    }
                    $site->content .= '<br/>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-top: 20px;" colspan=2>
                                <input type="submit" class="btn" style="width: 280px;" value="' . $GLOBALS["Lang"]["Save changes"] . '" /><br/><br/>
                                <a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a><br/><br/>
                            </td>
                        </tr>
                        </table>
                        </div>
                        </form>';
                } else {
                    if ($site->get[1] == "inbox") {
                        if (!empty($site->get[3])) {
                            $site->content = engine::error();
                            return;
                        }
                        $site->title = $GLOBALS["Lang"]["Messages"] . ' - ' . $site->title;
                        $site->content .= '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["Messages"] . '</h1><br/>';
                        if (empty($site->get[2])) {
                            $site->content .= '<center><iframe id="message_frame" src="/messages.php?id=' . $_SESSION["user"]["id"] . '" width=100% height=390 style="max-width: 700px;" ></iframe></center>' . '<a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a>';
                        } else {
                            $site->content .= '<center><iframe id="message_frame" src="/messages.php?mode=dialog&id=' . $_SESSION["user"]["id"] . '&target=' . $site->get[2] . '" width=100% height=390 style="max-width: 700px;" ></iframe></center>' . '<a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a>';
                        }
                    } else {
                        $site->content = engine::error();
                        return;
                    }
                }
            } else {
                $site->title = $GLOBALS["Lang"]["My Account"] . ' - ' . $site->title;
                $site->content = '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["My Account"] . '</h1><br/><br/>';
                if ($_SESSION["user"]["id"] == "1") {
                    $site->content .= '<a href="/admin"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Admin"] . '" /></a><br/><br/>';
                }
                $site->content .= '<a href="/account/inbox"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Messages"] . '" /></a><br/><br/>' . '<a href="/account/settings"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Settings"] . '" /></a><br/><br/>' . '<input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Logout"] . '" onClick="logout();"  /><br/><br/>';
            }
        } else {
            $site->title = $GLOBALS["Lang"]["Access denied"] . ' - ' . $site->title;
            $site->content = '<h3 style="padding-top: 100px;">' . $GLOBALS["Lang"]["Access denied"] . '</h3><br/>';
        }
    }
            <li><input type="checkbox" name="line_id_cb" value="<?php 
    echo htmlentities(${$class}->role_access_id);
    ?>
"></li>           
            <li><?php 
    echo form::hidden_field('role_code', $role_code_h);
    ?>
</li>
           </ul>
          </td>
          <td><?php 
    form::number_field_drs('role_access_id');
    ?>
</td>
          <td><?php 
    $eng_all = engine::find_all();
    foreach ($eng_all as $k => $v) {
        $v->obj_class_name_fn = ucwords(str_replace('_', ' ', $v->obj_class_name));
    }
    echo $f->select_field_from_object('obj_class_name', $eng_all, 'obj_class_name', 'obj_class_name_fn', ${$class}->obj_class_name, '', '', 1);
    ?>
</td>
          <td><?php 
    echo $f->select_field_from_array('access_level', role_access::$access_map, ${$class}->access_level);
    ?>
</td>
         </tr>
         <?php 
    $count = $count + 1;
}
?>
    function template($site)
    {
        $this->site = $site;
        $this->engine = $this->site->engine;
        if (!empty($_POST["contact"]) && !empty($_POST["text"]) && !empty($_SESSION["user"]["id"])) {
            engine::send_mail($site->configs["email"], $_POST["contact"], "New message from " . $_SERVER["HTTP_HOST"], str_replace("\n", "<br/>", $_POST["text"]));
            $site->activejs .= '
                    alert("' . $GLOBALS["Lang"]["Message sent successfully"] . '");
                 ';
        }
        $site->activejs .= '
            if(!window.jQuery) document.write(unescape(\'<script type="text/javascript" src="/libs/jquery-1.11.1.js">%3C/script%3E\')); 
            if(window.jQuery) try { 
                jQuery("a, img, div, input, select, textarea, button").tooltipster(); 
            }catch(err) {
                document.write(unescape(\'<script type="text/javascript" src="/libs/jquery.tooltipster.min.js">%3C/script%3E\'));
                jQuery("a, img, div, input, select, textarea, button").tooltipster();
            }
        ';
        if (!isset($_POST["jQuery"])) {
            $header = '<header id="mainHead">
    <div class="container">
        <div id="logo">
            <div id="logoOne"><a href="/"><img src="/img/logo.png" style="height: 65px;" alt="' . $site->config->name . '"></a></div>
            <div id="logoTwo"><a href="/" id="site_title">' . $site->title . '</a></div>
        </div>
        <div id="nav">
        <ul>
            <li><a href="/">' . $GLOBALS["Lang"]["Home"] . '</a></li>
            <li><a href="/content">' . $GLOBALS["Lang"]["Content"] . '</a></li>
            ';
            if (empty($_SESSION["user"]["id"])) {
                $header .= '<li class="last"><a href="/register" class="btn">' . $GLOBALS["Lang"]["Sign Up"] . '</a></li>
            <li class="last" id="last"><a href="#" class="btn" onClick="show_login_form();">' . $GLOBALS["Lang"]["Login"] . '</a></li>';
            } else {
                $header .= '<li class="last"><a href="/account" class="btn">' . $GLOBALS["Lang"]["My Account"] . '</a></li>
            <li class="last"  id="last"><a href="#" onClick="logout();" class="btn">' . $GLOBALS["Lang"]["Logout"] . '</a></li>';
            }
            $header .= '
        </ul></div>
        <div id="searchIcon" onClick=\'result = prompt("' . $GLOBALS["Lang"]["Search"] . '", ""); if(result){ window.location="/search/"+encodeURIComponent(result);  }\'>
            <img src="/img/search.png" style="height: 25px;" />
            <form id="search_form" method="GET" action="/search/"><input type="hidden" id="query" name="q" value="" /></form>
        </div>
        <a id="menuIcon"><img src="/img/menu.png" alt="' . $GLOBALS["Lang"]["Show navigation"] . '"></a>
        <div id="langIcon">
            <form method="POST" id="lang_select">
                <select name="lang" onChange=\'document.getElementById("lang_select").submit();\'>';
            if ($_SESSION["Lang"] == "en") {
                $header .= '<option selected>EN</option>';
            } else {
                $header .= '<option>EN</option>';
            }
            if ($_SESSION["Lang"] == "ru") {
                $header .= '<option selected>RU</option>';
            } else {
                $header .= '<option>RU</option>';
            }
            if ($_SESSION["Lang"] == "gr") {
                $header .= '<option selected>GR</option>';
            } else {
                $header .= '<option>GR</option>';
            }
            $header .= '
                </select>
            </form>
        </div>
    </div>
</header>
<section id="bigNav">
    <div class="container">
        <ul>
            <li><a href="/content">' . $GLOBALS["Lang"]["Content"] . '</a></li>';
            if (empty($_SESSION["user"]["id"])) {
                $header .= '
            <li><a href="#" onClick="show_login_form();">' . $GLOBALS["Lang"]["Login"] . '</a></li>
            <li><a href="/register">' . $GLOBALS["Lang"]["Sign Up"] . '</a></li>';
            }
            if (empty($_SESSION["user"]["id"])) {
                $header .= '
            <li style="display:none;"><a href="/sitemap.php" target="_blank">' . $GLOBALS["Lang"]["Sitemap"] . '</a></li>';
            } else {
                if ($_SESSION["user"]["id"] == "1") {
                    $header .= '
            <li><a href="/admin" target="_blank">' . $GLOBALS["Lang"]["Admin"] . '</a></li>';
                }
                $header .= '
            <li><a href="/account">' . $GLOBALS["Lang"]["Account"] . '</a></li>
            <li><a href="#" onClick="logout();">' . $GLOBALS["Lang"]["Logout"] . '</a></li>';
            }
            $header .= '
        </ul>
    </div>
</section>';
            $header .= '
<div id="content">
<!-- content -->
';
            $footer = '
<!-- /content -->
</div>
<section id="footer">
    <div class="container">
        <div class="footer_left">
            <div class="footer_contacts">
                <span>' . $GLOBALS["Lang"]["Get in Touch"] . '</span>
                <div style="clear:both; height: 25px;"></div>
                <a href="https://twitter.com/" target="_blank">
                    <div class="social_img"><img src="/img/social/tw.png" alt="Twitter"/></div>
                    <div style="padding-top: 7px;" title="' . $GLOBALS["Lang"]["Connect us at"] . ' Twitter">Twitter</div>
                </a>
                <div style="clear:both; height: 20px;"></div>
                <a href="https://www.facebook.com/" target="_blank">
                    <div class="social_img"><img src="/img/social/fb.png" alt="Facebook"/></div>
                    <div style="padding-top: 7px;" title="' . $GLOBALS["Lang"]["Connect us at"] . ' Facebook">Facebook</div>
                </a>
                <div style="clear:both; height: 10px;"></div>
            </div>
        </div>
        <div class="footer_right left-center" id="contact_us">
        <span>' . $GLOBALS["Lang"]["Contact Us"] . '</span>
        <div style="clear:both; height: 20px;"></div>
            <form method="POST">

                <textarea name="text" placeHolder="' . $GLOBALS["Lang"]["Your message here"] . '"
                ';
            if (!empty($_SESSION["user"]["id"])) {
                $footer .= '></textarea><br/>' . '<input type="submit" onClick=\'send_message();\' class="btn" style="width: 270px;" value="' . $GLOBALS["Lang"]["Send message"] . '"  />';
            } else {
                $footer .= 'onFocus="show_login_form();" ></textarea><br/>' . '<input type="button" class="btn" style="width: 270px;" value="' . $GLOBALS["Lang"]["Send message"] . '" onClick="show_login_form();"  />';
            }
            $footer .= '
            </form>
        </div>
        <div style="clear:both;"></div>
        
    </div>
    <div id="copyright">' . $GLOBALS["Lang"]["Copyright"] . ' <a href="http://' . $_SERVER["HTTP_HOST"] . '" title="' . $site->configs["description"] . '">' . $_SERVER["HTTP_HOST"] . '</a>, 2015. ' . $GLOBALS["Lang"]["All rights reserved"] . '</div>
    <div id="developed"> 
        <div id="caption">' . $GLOBALS["Lang"]["Developed by"] . ' <a onMouseOver=\'show_developer();\' onClick=\'window.open("http://nodes-studio.com");\'>Nodes Studio</a></div>
        <div id="freelance" onMouseOut=\'hide_developer();\'>
            <img src="/img/developed.png" title="Nodes Studio - Development Future!" onClick=\'window.open("http://nodes-studio.com");\' />
        </div>
    </div>
    <div style="clear:both;"></div>
</section>
<script src="/script.js" language="JavaScript" type="text/javascript"></script>
<!-- <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> -->
<script language="JavaScript" type="text/javascript">
if(!window.jQuery) document.write(unescape(\'<script type="text/javascript" src="/libs/jquery-1.11.1.js">%3C/script%3E\')); 
</script>
<script type="text/javascript" src="/jquery.js"></script>
<script src="/libs/jquery.tooltipster.min.js" type="text/javascript"></script>
<div id="floater">
    <img src="/img/up_button.png" alt="' . $GLOBALS["Lang"]["Up"] . '">
</div>
';
        }
        if (empty($site->get)) {
            $this->site->content = $header . '
<section id="topSection">
</section>
<section id="contentSection">
    <div class="container">
        ' . $this->site->content . '
    </div>
</section>
<section id="bottomSection">
</section>
' . $footer;
        } else {
            if (!empty($site->menu)) {
                $header .= '
    <nav>
        <div id="submenu">
            <div onClick=\'show_more(this);\' id="submenu_button" ><img src="/img/sliderBars.png" title="' . $GLOBALS["Lang"]["Show All"] . '" /></div>
            ' . $site->menu . '
        </div>
    </nav>
    <section id="contentSection">
    ';
            } else {
                $header .= '<section id="contentSection" style="padding-top: 80px;">';
            }
            $this->site->content = $header . '
    <div class="container">
        ' . $this->site->content . '
    </div>
</section>
' . $footer;
        }
    }
Beispiel #21
0
    }
    return str_replace(array("\t", "  ", "\n", "\r", "<!--br-->"), array("", " ", "", "", "\n"), $buffer);
}
include_once ROOT_DIR . SL . 'engine' . SL . 'backwards_compatibility.php';
mb_internal_encoding('UTF-8');
if (strpos($_SERVER["REQUEST_URI"], 'art/download') === false && !strpos($_SERVER["REQUEST_URI"], '/rss/') && _TYPE_ != 'cron' && _TYPE_ != 'api' && !(_TYPE_ == 'ajax' && $_GET['f'] == 'download')) {
    ob_start('myoutput');
}
include_once ROOT_DIR . SL . 'engine' . SL . 'config.php';
def::import($def);
if (!def::site('domain')) {
    def::set('site', 'domain', $_SERVER['SERVER_NAME']);
}
define('SITE_DIR', str_replace(array('/', '\\'), SL, rtrim(def::site('dir'), '/')));
if (def::site('domain') != $_SERVER['SERVER_NAME'] && _TYPE_ != 'cron' && !empty($_SERVER['REMOTE_ADDR']) && $_SERVER['SERVER_NAME'] != 'upload.4otaku.org') {
    engine::redirect('http://' . $def['site']['domain'] . $_SERVER["REQUEST_URI"], true);
}
if (_TYPE_ != 'cron' && _TYPE_ != 'api') {
    $check = new check_values();
    include_once ROOT_DIR . SL . 'engine' . SL . 'twig_init.php';
}
if (_TYPE_ != 'cron') {
    list($get, $post) = query::get_globals($_GET, $_POST);
}
include_once ROOT_DIR . SL . 'engine' . SL . 'metafunctions.php';
// Тут мы работаем с сессиями
if (_TYPE_ != 'cron' && _TYPE_ != 'api') {
    // Логично, что у крона или апи сессии нет.
    // Удалим все левые куки, нечего захламлять пространство
    foreach ($_COOKIE as $key => $cook) {
        if ($key != 'settings') {
Beispiel #22
0
<? engine::error_headers(); ?>
<? include_once('templates'.SL.'side'.SL.'head.php'); ?>
<body>	
	<? include_once('templates'.SL.'side'.SL.'header.php'); ?>
	<table width="100%">
		<tr>
			<td valign="top" id="sidebar">
				<? include_once('templates'.SL.'side'.SL.'sidebar.php'); ?>
			</td>		
			<td valign="top" id="content">
				<div class="post">
					<? include_once('templates'.SL.'side'.SL.'top.php'); ?>
					<table width="100%" id="error">
						<tr>
							<td>
								<img src="<?php 
echo $def['site']['dir'];
?>
/images/booru_404_<?php 
echo rand(1, 2);
?>
.jpg">
							</td>
						</tr>			
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="2" id="footer">
Beispiel #23
0
<?php

session_start();
//require_once('./include/sendmail.php');
require_once './include/engine.php';
require_once './include/login.php';
$main = new engine();
$main->_mainName = "MailerBot";
$title = $main->title();
/*				if(isset($_GET['app']) == 'stat_add&tocken=3sd456gds4567')
				{
					echo'ok';
				}*/
$page = '';
if (isset($_GET['page1'])) {
    $page = $_GET['page1'];
    if ($page == 'logout') {
        logout();
    }
}
?>
<!doctype html>
<html>
<head>
 	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Bot do marketingu emailingowego. Proste rzarządzanie kampanią mailingową i jej prosta automatyzacja.">
    <meta name="author" content="Kamil Żmijowski">
<script>
  $(document).ready(function() {
 static function upload_image($photo_name, $path, $w, $h)
 {
     if (is_uploaded_file($_FILES[$photo_name]['tmp_name'])) {
         $f_name = "";
         $a = md5(date('U') . $_FILES[$photo_name]["name"]);
         $ext = strtolower(array_pop(explode(".", $_FILES[$photo_name]["name"])));
         $f_name = $path . "/big/" . $a . "." . $ext;
         $thumb_name = $path . "/thumb/" . $a . "." . $ext;
         if ($f_name != "") {
             if (move_uploaded_file($_FILES[$photo_name]["tmp_name"], $f_name)) {
                 $size = getimagesize($f_name);
                 if ($size[0] > $size[1]) {
                     $width = $w;
                     $height = round($width * ($size[1] / $size[0]));
                 } else {
                     $height = $h;
                     $width = round($height * ($size[0] / $size[1]));
                 }
                 if ($size[0] > 1000 || $size[1] > 1000) {
                     exec('mogrify -resize ' . $width * 3 . 'x' . $height * 3 . ' ' . $f_name);
                 }
                 if (engine::resize_image($f_name, $thumb_name, intval($width), intval($height))) {
                     return $a . "." . $ext;
                 }
                 return 'error';
             }
             return 'error';
         }
         return 'error';
     }
     return 'error';
 }
Beispiel #25
0
	function slideshow() {
		global $check; global $def; global $sets; global $url;
		$types = array ('tag','author','category','mixed','date','pool');
		if (in_array(query::$get['type'],$types) && $check->num(query::$get['id'])) {
			$limit = ' order by sortdate desc limit '.(query::$get['id'] - 1).', 5'; $area_prefix = 'area="'.$def['area'][0].'" and ';
			switch (query::$get['type']) {
				case "mixed":
					$url['area'] = 'main';  $area_prefix = '';
					$area = "(".engine::mixed_make_sql(engine::mixed_parse(html_entity_decode(urldecode(query::$get['area'])))).")";
					break;
				case "date":
					$parts = explode('-',query::$get['area']);
					if (is_numeric($parts[0].$parts[1].$parts[2]) && count($parts) == 3)
						$area = '(pretty_date ="'.obj::transform('text')->rumonth($parts[1]).' '.$parts[2].', '.$parts[0].'")';
					break;
				case "pool":
					$pool = Database::order('order', 'asc')
						->limit(5, query::$get['id'] - 1)
						->get_vector('art_in_pool', 'art_id', 'pool_id = ?', query::$get['area']);

					$area = "(id=".implode(' or id=',$pool).")";
					$limit = ''; $area_prefix = '';

					break;
				default:
					$area = '(locate("|'.urldecode(query::$get['area']).'|",art.'.query::$get['type'].'))';
			}
			if (!$sets['show']['nsfw'] && query::$get['type'] != 'pool')
				$area .= ' and !locate("|nsfw|",art.category)';
			elseif ($sets['show']['nsfw'] && query::$get['type'] != 'pool') {
				if (!$sets['show']['yaoi']) $area .= ' and !(locate("|yaoi|",art.tag) and locate("|nsfw|",art.category))';
				if (!$sets['show']['furry']) $area .= ' and !(locate("|furry|",art.tag) and locate("|nsfw|",art.category))';
				if (!$sets['show']['guro']) $area .= ' and !(locate("|guro|",art.tag) and locate("|nsfw|",art.category))';
			}
			$return = obj::db()->sql('select id, md5, extension, resized from art where ('.$area_prefix.$area.')'.$limit,'id');
			if (query::$get['type'] == 'pool') {
				$_return = $return; unset($return);
				foreach ($pool as $one) $return[$one] = $_return[$one];
			}
			if (is_array($return)) {
				foreach ($return as &$art) {
					if (!$art['resized']) $sizes = getimagesize('images/booru/full/'.$art['md5'].'.'.$art['extension']);
					else $sizes = getimagesize('images/booru/resized/'.$art['md5'].'.jpg');
					$art['height'] = $sizes[1];
				}
				if ($sets['show']['translation']) {
					$where = 'art_id='.implode(' or art_id=',array_keys($return));
					$translations = obj::db()->sql('select art_id, data from art_translation where ('.$where.' and active = 1)','art_id');
					if (is_array($translations)) foreach ($translations as $key => $translation) {
						$return[$key]['translations']['full'] = unserialize(base64_decode($translation));
						if ($return[$key]['resized'] && is_array($return[$key]['translations']['full'])) {
							$size = explode('x',$return[$key]['resized']);
							$coeff = $size[0] / $def['booru']['resizewidth'];
							foreach ($return[$key]['translations']['full'] as $one) {
								foreach ($one as $field => &$param) if ($field != 'text') $param = round($param / $coeff);
								$return[$key]['translations']['resized'][] = $one;
							}
						}
					}
				}
				return $return;
			}
			else die ("finish");
		}
	}
Beispiel #26
0
 public function __construct()
 {
     $this->session = session::getInstance();
     $this->engine = engine::getInstance();
     $this->template = template::getInstance();
 }
Beispiel #27
0
<?php

/**
 * @author    Mathieu Chocat
 * @version   $Id: index.php 55 2007-02-07 13:10:01Z mathieu $
 * @copyright (c) 2006 Sygil.eu
 **/
define('EXEC_TIME', microtime(true));
require_once 'include/config.php';
require_once 'include/class/db.php';
require_once 'include/class/engine.php';
require_once 'include/class/session.php';
$engine = engine::getInstance();
$engine->initialize();
$engine->execute();
$engine->finalize();
unset($engine);
            }
            $input .= "<option value='{$key}' {$selectedhtml}>{$val}</option>\n";
        }
        $input .= "</select>\n";
        return $input;
    }
    public function button($label, $href, $label_class = null, $style = null)
    {
        $input = sprintf('<a class="btn btn-default"  style="%s" href="%s"><i class="fa fa-pencil-square-o"></i>%s</a>', $style, $href, $label);
        return $input;
    }
    public function link($link)
    {
        if (empty($link['style'])) {
            $link['style'] = null;
        }
        $input = sprintf('<a href="%s" %s><i class="fa fa-pencil-square-o"></i> %s</a> ', $link['href'], $link['style'], $link['label']);
        return $input;
    }
}
$engine = new engine();
$error = new error();
$go = new go();
$input = new input();
include $engine->func('Parsedown');
$Parsedown = new Parsedown();
function random_gravatar($size = 100, $email = "")
{
    $random_image = array('mm');
    return "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?r=g&s=" . $size . "&d=" . $random_image[array_rand($random_image)];
}
      <!--    START OF FORM HEADER-->
      <div id ="form_header">
       <div class="error"></div><div id="loading"></div>
       <div class="show_loading_small"></div>
       <?php 
echo !empty($show_message) ? $show_message : "";
?>
 
       <!--    End of place for showing error messages-->
       <span class="heading">Object/Class Details </span>
       <div class="large_shadow_box">
        <ul class="column four_column">
         <li>
          <label> Object Name : </label>
          <?php 
echo $f->select_field_from_object('obj_class_name', engine::find_all(), 'obj_class_name', 'obj_class_name', $obj_class_name_h);
?>
          <a name="show" href="form.php?class_name=secondary_field&role_code=" class="show role_code">
           <img src="<?php 
echo HOME_URL;
?>
themes/images/refresh.png"/></a> 
         </li>						
         <li><label>Description : </label>
          <?php 
echo $f->text_field('description', '', '50');
?>
         </li>
        </ul>
       </div>
      </div>
Beispiel #30
0
 function get_data()
 {
     global $url;
     if ($url[2] == 'search') {
         $page = empty($url[5]) ? 1 : $url[5];
         return $this->search($url[3], $page);
     }
     $return['display'] = array('logs_navi', 'logs_search', 'logs_body', 'logs_arrows');
     if (!$this->nocache) {
         $return['logs'] = base64_decode(obj::db()->sql('select cache from logs where (year=' . $url[2] . ' and month =' . $url[3] . ' and day=' . $url[4] . ' and cache_key =' . static::$cache_key . ')', 2, 'cache'));
     }
     if (!$return['logs']) {
         $today = mktime(0, 0, 0, $url[3], $url[4], $url[2]) * 1000;
         $rooms = 'roomID = ' . implode(' or roomID = ', static::$room_ids);
         $return['logs'] = obj::db('chat')->sql('select nickname, logTime, body from ofMucConversationLog where ((' . $rooms . ') and cast(logTime as unsigned) > ' . $today . ' and cast(logTime as unsigned) < ' . ($today + 86400000) . ') order by logTime');
         if (is_array($return['logs'])) {
             foreach ($return['logs'] as $key => &$log) {
                 if (trim($log['body'])) {
                     $log['text'] = $this->format_logs($log['body'], $log['nickname']);
                 } else {
                     unset($return['logs'][$key]);
                 }
             }
         }
     }
     if (!$return['logs']) {
         $return['nologs'] = 'За этот день нет ни одного лога.';
     }
     $start = array($this->start_year, $this->start_month, $this->start_day);
     $end = array(date("Y"), date("n"), date("j"));
     $current = array($url[2], $url[3], $url[4]);
     $base = substr(get_called_class(), 8);
     if (array_diff_assoc($end, $current) && is_array($return['logs'])) {
         $this->make_logs_cache($return['logs'], $url[2], $url[3], $url[4]);
     }
     $rumonth = array('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь');
     for ($i = $start[0]; $i <= $end[0]; $i++) {
         $start_month = $i == $start[0] ? $start[1] : 1;
         $end_month = $i == $end[0] ? $end[1] : 12;
         for ($j = $start_month; $j <= $end_month; $j++) {
             $return['month'][$i == $current[0] && $j == $current[1] ? 'current' : '/' . $base . '/' . $i . '/' . $j . '/' . ($j > $start[1] ? 1 : $start[2]) . '/'] = $rumonth[$j - 1] . ' ' . $i;
         }
     }
     $return['log_base'] = $base;
     $yesterday = mktime(12, 0, 0, $url[3], $url[4] - 1, $url[2]);
     $tomorrow = mktime(12, 0, 0, $url[3], $url[4] + 1, $url[2]);
     $start_time = mktime(0, 0, 0, $start[1], $start[2], $start[0]);
     if ($yesterday > $start_time) {
         $return['navi']['yesterday'] = array('url' => '/' . $base . '/' . date("Y", $yesterday) . '/' . date("n", $yesterday) . '/' . date("j", $yesterday) . '/', 'name' => $rumonth[date("n", $yesterday) - 1] . ' ' . date("j", $yesterday));
     } elseif ($yesterday < mktime(0, 0, 0, $start[1], $start[2] - 1, $start[0])) {
         $return['nologs'] = "Логов раньше, чем за " . Transform_Time::to_string($start_time) . " попросту нет, комната появилась в тот день.";
         engine::error_headers();
     }
     $return['navi']['today'] = array('name' => $rumonth[$url[3] - 1] . ' ' . $url[4]);
     if ($tomorrow < mktime(24, 0, 0, $end[1], $end[2], $end[0])) {
         $return['navi']['tomorrow'] = array('url' => '/' . $base . '/' . date("Y", $tomorrow) . '/' . date("n", $tomorrow) . '/' . date("j", $tomorrow) . '/', 'name' => $rumonth[date("n", $tomorrow) - 1] . ' ' . date("j", $tomorrow));
     } elseif ($tomorrow > mktime(24, 0, 0, $end[1], $end[2] + 1, $end[0])) {
         $return['nologs'] = "Забегаем в будущее?";
         engine::error_headers();
     }
     return $return;
 }