/** * Editor nav menu */ function action_api_editor_menu() { /** @var tf_editor $ed */ $ed = core::lib('editor'); $menu = array(); // dies on get_editor_actions $menu['core'] = core::get_instance()->get_editor_actions(); foreach (core::modules() as $module) { $menu[$module->get_name()] = $module->get_editor_actions(); } $menuNormalized = array(); foreach ($menu as $key => $actions) { $submenuNormalized = array(); if (!empty($actions)) { foreach ($actions as $subKey => $subMenu) { if (!empty($subMenu['url'])) { $subMenu['url'] = $ed->make_url($subMenu['url'], 1); } $submenuNormalized[] = !$subMenu ? array() : array_merge(array('id' => $subKey), $subMenu); } $menuNormalized[] = array('id' => $key, 'title' => i18n::T(array($key, '_name')), 'actions' => $submenuNormalized); } } $this->renderer->set_ajax_answer($menuNormalized)->ajax_flush(); }
/** * Create auth lib * @param users_collection users handle * @param bool disable auth */ function __construct(tf_users $musers, $null_auth = false) { $this->_cookie_domain = '.' . core::get_instance()->get_main_domain(); $this->mod_users = $musers; $this->users = $musers->get_users_handle(); $this->sessions = $musers->get_sessions_handle(); $this->_null_auth = $null_auth; $this->onload(); }
/** * Creator */ protected function __construct() { // $this->storage = new logger_storage_null(); // return; $this->storage = core::get_instance()->class_register('logs', array('no_preload' => true), true); // cant create storage, try file-mock! if (!$this->storage) { $this->storage = new logger_storage_null(); } }
/** * Pissdrunk construct */ function __construct() { $this->cache = core::lib('cache')->get_engine($this->_cache_engine); $this->handle = core::get_instance()->class_register('page_cache', array('no_preload' => true)); $this->_enabled = !core::get_instance()->get_cfg_var('disable_page_cache', false); if (!empty($this->_cache_threshold) && $this->_cache_threshold != 1) { foreach ($this->_threshold_table as $k => $v) { $this->_threshold_table[$k]['cache'] = $v['cache'] * $this->_cache_threshold; } } }
/** * Doamin matched in initial_route */ function set_current() { $this->_current = true; if (0 != $this->template) { $core = core::get_instance(); $templates = $core->get_cfg_var('templates'); if (isset($templates[$this->template])) { core::dprint(array('SITE_LAYOUT : %s', $templates[$this->template]), core::E_DEBUG1); core::lib('renderer')->set_layout($templates[$this->template]); } } }
function run() { $q = trim(urldecode($this->request->get('q'))); $q = core::lib('db')->escape($q); if (strings::strlen($q) < 2) { $this->renderer->set_ajax_result(false)->set_ajax_message('Короткое сообщение')->ajax_flush(false); return; } $pmod = $this->_controller->get_context(); $ph = $pmod->get_search_handle()->set_working_fields('keyword')->set_limit(10); if (!empty($q)) { $ph->set_where("keyword like '%{$q}%' AND c_count > 0"); } $sugg = $ph->load()->render(); core::get_instance()->ajax_answer($sugg); }
/** * Make search */ public function make_search($key) { $id = false; $psearchs = $this->_controller->get_context()->get_search_handle(); $psearch_results = $this->_controller->get_context()->get_search_result_handle(); $core = core::get_instance(); $site_id = $this->_controller->get_context()->get_current_site_id(); // check key exists if ($search_item = $psearchs->get_by_key($key, $site_id)) { $id = $search_item->id; $this->_found = $search_item->c_count; } // if too old, clean search results, make it new if ($search_item) { if ($search_item->time + $this->_expire_time < time()) { // clear $search_item->remove(); $search_item = null; } } if (!$search_item) { $this->_found = 0; $cdata = core::module('sat')->get_node_handle(); $orig_key = $key; # remove this for non test # $key = strings::convert_from($key); $key = core::lib('db')->escape(strings::strtolower($key)); $cdata->set_where("site_id = {$site_id} AND active AND LCASE(title) LIKE '%{$key}%'")->load(); $result = array(); $ctype = $core->get_ctype('sat.node')->get_id(); $this->_found = $cdata->count(); if (!$cdata->is_empty()) { foreach ($cdata as $item) { $result[] = array('title' => $item->title, 'description' => strip_tags($item->description), 'time' => $item->updated_at, 'url' => $item->get_url(), 'ctype' => $ctype, 'post_id' => $item->id); } } // create search history item $id = $psearchs->create(array('uid' => $this->_controller->get_user()->id, 'keyword' => $key, 'c_count' => $this->_found, 'site_id' => $site_id)); // fill results foreach ($result as $v) { $v['pid'] = $id; $psearch_results->create($v); } } return $id; }
/** * Block entry point * * @param array * module // module tag * action // block action * cache // seconds, cache data * other params */ function smarty_function_block($params, &$smarty) { $core = core::get_instance(); foreach ($params as $k => $v) { if (!isset(${$k})) { ${$k} = $v; } } $cache_this = false; // $core->time_check('c1', true, true); if (isset($cache)) { $cacher_factory = core::lib('cache'); if ($cacher_factory->has_memory()) { $cacher = $cacher_factory->get_memory_handle(); $cache_time = $cache; unset($params['cache']); $cache_id = 'block_' . md5(serialize($params)); $result = $cacher->get($cache_id, false); if (false !== $result) { core::dprint('cache hit : ' . $params['action'] . ' - ' . $core->time_check('c1', true)); return $result; } $cache_this = true; } } try { if (empty($module)) { $module = 'core'; } if ($pmod = $core->module($module)) { unset($params['action'], $params['module']); $result = $pmod->run_block($action, $params); if ($cache_this) { $cacher->set($cache_id, $result, $cache_time); } // core::var_dump('no cache : ' . $cache_id, $core->time_check('c1', true)); return $result; } } catch (modules_exception $e) { return '[block] ' . $e->getMessage(); } return false; }
/** * Create handle * @param array params */ public static function factory($parms = 'smarty') { $smarty = false; // $test = loader::$root_path . loader::DIR_MODULES . 'core/tplparser/smarty/Smarty.class.php'; $test = loader::get_root() . loader::DIR_EXT . 'smarty/Smarty.class.php'; if (fs::file_exists($test)) { require $test; $smarty = new Smarty(); $smarty->compile_check = true; $smarty->force_compile = false; // true; $template = core::get_instance()->get_cfg_var('template'); $smarty->caching = false; //TRUE; //$smarty->cache_lifetime = 3600; $smarty->debugging = core::get_instance()->get_cfg_var('debug_templates'); } else { $smarty = new tplparser_mock(); core::dprint('[tplparser] using mock'); } self::$parser = $smarty; self::set_template($template); return $smarty; }
/** * Get kernel * @return core */ static function core() { return self::$_core ? self::$_core : (self::$_core = core::get_instance(self::_option(self::OPTION_CORE_PARAMS))); }
/** * Create or retrieve object bu class * * module name prefixed with {@see loader::CLASS_PREFIX} * * @param string module_name * @param array config ( order_sql , where_sql, limit_sql ) * tpl_table - template name block * @param boolean standalone (регистрировать в системе или нет) * * @return object (&by ref) * * @throws core_exception */ function class_register($module, $config = array(), $standalone = false) { $tmp = false; /* check modules path if yes, make namespace for it */ $path_prefix = $this->root_dir; /* standalone class support without register in $core->classes db class naming: /classes/module/ +- collection (module_collection) +- item (module_item) */ $m_class = $module . '_collection'; // chroot support // [tf]obsolete: auto chroot to module $f_class_path = $path_prefix . 'classes/' . $module . '/'; $f_class = array($f_class_path . 'collection' . loader::DOT_PHP, $f_class_path . 'item' . loader::DOT_PHP); if (!class_exists($m_class)) { if (!fs::file_exists($f_class[0]) || !fs::file_exists($f_class[1])) { core::dprint("[color=red][ERROR CLASS_REGISTER] file not found; [/color] {$module} ({$f_class_path})"); core::dprint($f_class); throw new core_exception("Class register failed : {$module} in " . $path_prefix, core::E_ERROR); return $tmp; // false; } require_once $f_class[0]; require_once $f_class[1]; } if (!$standalone && isset($this->classes[$module])) { return $this->classes[$module]; } /* use prefix render to {$tpl_table} sql from {$table} */ $table_ = $module; $config['prefix'] = core::get_instance()->get_cfg_var(array('database', 'prefix')); $table_ = $config['prefix'] . $table_; // if not passed, set to module tag if (!isset($config['tpl_table'])) { $config['tpl_table'] = $module; } // new one $config_ = array('load' => true, 'table' => $table_, 'root' => $f_class_path); if ($config !== false) { $config_ = array_merge($config_, $config); } // preload fix if (isset($config['no_preload'])) { unset($config_['load']); } // In editor, check for class with 'editor_' prefix if (core::in_editor()) { $editor_class = 'editor_' . $m_class; if (class_exists($editor_class)) { $m_class = $editor_class; } $config_['in_editor'] = true; } $tmp = new $m_class($config_); if ($standalone) { return $tmp; } $this->classes[$module] = $tmp; return $this->classes[$module]; }
/** * Make url with context */ function normalize_url(&$url) { $core = core::get_instance(); $base = $core->get_base_url(); $url = $base . $url; }
/** * Translate * @param mixed $id */ public function translate($id) { $mod = $this->tag; $ret = core::get_instance()->get_langword($id, $mod); if (!$ret) { core::dprint('[core::translate] undefined : ' . $id . ($mod ? " in {$mod}" : '')); } return $ret; }
/** * SQL query * * @param mixed $query * @param mixed $transaction */ function sql_query($query, $options = null) { if (empty($query)) { core::dprint('Empty sql_query call'); return false; } if (is_array($query)) { $query = vsprintf($query[0], array_slice($query, 1)); } $starttime = microtime(true); ++$this->_counter; $tm_ = core::get_instance()->time_check('mysql', 1, 1); unset($this->query_result); $this->num_queries++; $this->_connect(); if (!$this->_connect_id && class_exists('core', 0)) { core::dprint(array('[SQL_ERROR] no connect %s', $query), core::E_SQL); } if (!empty($options['mysql_unbuffered'])) { $this->query_result = mysql_unbuffered_query($query, $this->_connect_id); } else { $this->query_result = mysql_query($query, $this->_connect_id); } $this->_last_query = $query; if ($this->query_result) { $endtime = microtime(true); $this->sql_time += $endtime - $starttime; if (core::get_instance()->cfg('debug_sql') >= 100) { core::dprint('<b>' . $this->_counter . ' ' . $this->num_queries . ') ' . htmlspecialchars($query) . ' [' . round($this->sql_time, 4) . 'ms]</b>'); // debug code idea by jovani (phpbbguru.net/community/profile.php?mode=viewprofile&u=12) if (strtoupper(substr($query, 0, 6)) == "SELECT") { $x = mysql_query("EXPLAIN {$query}", $this->_connect_id); $z = array(); while ($y = mysql_fetch_array($x, MYSQL_ASSOC)) { core::dprint(" » tbl = " . $y['table'] . " type = " . $y['type'] . " possible = " . $y['possible_keys'] . " used = " . $y['key'] . " len = " . $y['key_len'] . " ref = " . $y['ref'] . " rows = " . $y['rows'] . " extra = " . $y['Extra']); } mysql_free_result($x); } } // replace password in query for log $query = preg_replace("#password = '******'#U", "password = '******'", $query); if (core::get_instance()->get_cfg_var('debug_sql')) { $tm_ = core::get_instance()->time_check('mysql', 1); core::dprint($this->_counter . '. ' . $query . ' --[time : ' . $tm_ . ' s]', core::E_SQL); if (0 && ($console = core::lib('console'))) { $dbg_trace = $console->debug_backtrace_smart(); if (isset($dbg_trace[2]) && !isset($dbg_trace[2]['class'])) { $dbg_trace[2]['class'] = ''; } $dbg_info = $dbg_trace[1]['file'] . ' in ' . $dbg_trace[1]['line'] . (!isset($dbg_trace[2]) ? '' : " ({$dbg_trace[2]['class']}::{$dbg_trace[2]['function']}) "); core::dprint(' -- in ' . $dbg_info); } } } else { $endtime = microtime(true); $this->sql_time += $endtime - $starttime; if (core::get_instance()->get_cfg_var('debug_sql')) { $tm_ = core::get_instance()->time_check('mysql', 1); $err = $this->sql_error(); core::dprint('[* SQL FAIL] ' . $query, core::E_SQL); core::dprint('[* SQL FAIL] ' . $err['message'] . ' : ' . $err['code'] . ' --[time : ' . $tm_ . ' s]', core::E_SQL); } } return $this->query_result; }
return; break; default: $this->set_action_name($subsection . '_edit'); $attachs->prepare2edt($edit_id); break; } } /** * New */ if ($operation == 'new') { $this->set_action_name($subsection . '_new'); } /** * Post modify submit */ if (isset($post['attach_submit'])) { $id = core::get_params('id'); $bulk = core::lib('request')->get_bulk(); $post_item->modify_attach($bulk, $id); // $attachs->modify($bulk, $id); if ($post_type == 'videos' && !empty($bulk['file']['size']) && !preg_match('#\\.flv$#', $bulk['file']['name'])) { core::get_instance()->set_message(array('content', 'videos_flv_pending')); } } // render if (!$edit_id && $operation != 'new') { $attachs->set_tpl_table('attach'); $attachs->render2edt(); }
/** * If we in subdomain and * url goes to domain, fix it * Call this for every link */ function normalize_post_url(&$url) { $ctx = core::get_instance(); if ($ctx->get_sub_domain() && substr($url, 0, 1) == '/') { $url = $this->get_protocol() . $ctx->get_main_domain() . $url; } }
/** * Override registry get method * @throws modules_exception */ public function get($id) { if ($id == 'core') { return core::get_instance(); } $return = parent::get($id); if (!$return) { // try deferred $return = $this->resolve_deferred($id); if (!$return) { throw new module_exception('Try to get unloaded module ' . $id); } } return $return; }
/** * SQL query * * @param mixed $query * @param mixed $transaction */ function sql_query($query = "", $transaction = FALSE) { $starttime = microtime(true); ++$this->_counter; //DEBUG $tm_ = core::get_instance()->time_check('mysql', 1, 1); // // Remove any pre-existing queries // unset($this->query_result); if ($query != "") { // core_c::cprint('[color=darkgreen]'.$query.'[/color]'); $cache_ret = $this->cache_check($query); #core_c::cprint("[code type=php]{$query}[/code]"); if ($cache_ret !== true) { $this->num_queries++; $this->_connect(); if ($transaction == self::BEGIN_TRANSACTION && !$this->in_transaction) { $result = mysql_query("BEGIN", $this->db_connect_id); if (!$result) { return false; } $this->in_transaction = TRUE; } $this->query_result = mysql_query($query, $this->db_connect_id); if ($cache_ret !== -1 && ($this->cache_cache_1items_queries || !$this->cache_cache_1items_queries && $this->sql_numrows($this->query_result) > 1)) { $this->query_result = $this->cache_query($query, $this->query_result); } } else { $this->query_result = $this->cache_get(); return $this->query_result; } } else { if ($transaction == self::END_TRANSACTION && $this->in_transaction) { $result = mysql_query("COMMIT", $this->db_connect_id); } } if ($this->query_result) { unset($this->row[$this->query_result]); unset($this->rowset[$this->query_result]); if ($transaction == self::END_TRANSACTION && $this->in_transaction) { $this->in_transaction = FALSE; if (!mysql_query("COMMIT", $this->db_connect_id)) { mysql_query("ROLLBACK", $this->db_connect_id); return false; } } $endtime = microtime(true); $this->sql_time += $endtime - $starttime; if (defined('SQL_DEBUG')) { $this->syslog('<b>' . $this->_counter . ' ' . $this->num_queries . ') ' . htmlspecialchars($query) . ' [' . round($this->sql_time, 4) . 'ms]</b>'); // debug code idea by jovani (phpbbguru.net/community/profile.php?mode=viewprofile&u=12) if (strtoupper(substr($query, 0, 6)) == "SELECT") { $x = mysql_query("EXPLAIN {$query}", $this->db_connect_id); $z = array(); while ($y = mysql_fetch_array($x, MYSQL_ASSOC)) { $this->syslog(" » tbl = " . $y['table'] . " type = " . $y['type'] . " possible = " . $y['possible_keys'] . " used = " . $y['key'] . " len = " . $y['key_len'] . " ref = " . $y['ref'] . " rows = " . $y['rows'] . " extra = " . $y['Extra']); } mysql_free_result($x); } } // replace password in query for log $query = preg_replace("#password = '******'#U", "password = '******'", $query); if (core::get_instance()->get_cfg_var('debug_sql')) { $tm_ = core::get_instance()->time_check('mysql', 1); core::dprint('[code type=sql] SQL] ' . $this->_counter . '. ' . $query . ' --[time : ' . $tm_ . ' s][/code]'); if (0 && ($console = core::lib('console'))) { $dbg_trace = $console->debug_backtrace_smart(); if (isset($dbg_trace[2]) && !isset($dbg_trace[2]['class'])) { $dbg_trace[2]['class'] = ''; } $dbg_info = $dbg_trace[1]['file'] . ' in ' . $dbg_trace[1]['line'] . (!isset($dbg_trace[2]) ? '' : " ({$dbg_trace[2]['class']}::{$dbg_trace[2]['function']}) "); core::dprint(' -- in ' . $dbg_info); } } return $this->query_result; } else { if ($this->in_transaction) { mysql_query("ROLLBACK", $this->db_connect_id); $this->in_transaction = FALSE; } $endtime = microtime(true); $this->sql_time += $endtime - $starttime; if (core::get_instance()->get_cfg_var('debug_sql')) { $tm_ = core::get_instance()->time_check('mysql', 1); $err = $this->sql_error(); core::dprint('[code type=sql] * SQL FAIL] ' . $query); core::dprint('[code type=sql] * SQL FAIL] ' . $err['message'] . ' : ' . $err['code'] . ' --[time : ' . $tm_ . ' s][/code]'); } return false; } }
function __construct() { $this->db = db_loader::get(array('engine' => 'null')); $this->core = core::get_instance(); $this->prepare_valid_fields(); }
//throw new controller_exception('Action not found'); } else { /** * Create post * supplied type_name and title */ // @todo check rate if (!empty($post)) { if (empty($post['title'])) { $this->get_context()->get_core()->set_message('error_empty_title'); $this->get_context()->get_core()->set_message_data($post, true); } try { $id = $post_handle->create_empty($post, $user); } catch (validator_exception $e) { $this->set_null_template(); core::get_instance()->set_raw_message($e->getMessage()); return; } if ($id) { // well done, move user to post edit $url = $this->get_context()->get_cp_links('post'); $url = $url['url'] . $id . '/'; functions::redirect($url); core::halt(); } else { core::get_instance()->set_message(array('users', 'error_post_too_often')); } // redirect to this post } }
* @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: index.php,v 1.2.6.1 2008/10/24 13:19:05 j4ck Exp $ */ define('IN_MAIN', 'I think so'); define('IN_EDITOR', 'Hell year'); require '../modules/core/loader.php'; // disable cache functions::headers_no_cache(); if (!core::lib('auth')->logged_in() || 'admin' != core::lib('auth')->get_user()->get_level()) { // disable auth functions::redirect('/'); exit; } $module = core::get_params()->module; if (!empty($module) && 'core' != $module) { try { if ($mod = core::module($module)) { $mod->on_editor(); } } catch (modules_exception $e) { // module not found core::get_instance()->error404('Module not found'); } } else { // core handler core::get_instance()->on_editor(); } // run core::get_instance()->main();
<?php require "../loader.php"; /** @var mail_tpl_collection */ $tmail = core::get_instance()->get_mail_tpl_handle(); /** @var \tf\module\core\mail_tpl_item */ $item = $tmail->where('name', "feedback")->load_first(); test_assert($item instanceof mail_tpl_item); $to = '*****@*****.**'; $vars = array('message' => 'blabla', 'title' => 'Hello from ' . __FILE__); test_assert($item->send($to, $vars));
/** * mpbill * * @package TwoFace * @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: sms_vip.php,v 1.1.2.4 2008/10/24 13:18:53 j4ck Exp $ */ /** * /modules/users/money/sms_vip.php?user_id=71111111111&num=1121&msg=admin * &skey=807140ca5ba73a2455029e952beae13a&operator_id=299&date=2008-10-23+17%3A01%3A50&smsid=1379554447&msg_trans=admin&operator=operator&test=1 */ require '../../../modules/core/loader.php'; ini_set('dispaly_errors', 'off'); $core = core::get_instance(); $core->lib('logger')->log('SMS Payment', print_r($_GET, 1)); $smskey = $core->get_cfg_var('sms_seckey', ''); core::lib('renderer')->set_content_type('text/plain'); $smsid = functions::request_var('smsid', ''); $num = functions::request_var('num', ''); $operator = functions::request_var('operator', ''); $userid = functions::request_var('user_id', ''); $cost = functions::request_var('cost', ''); $msg = functions::request_var('msg', ''); $skey = functions::request_var('skey', ''); list($prefix, $msg) = explode(' ', $msg); if ($skey != md5($smskey)) { header("HTTP/1.0 404 Not Found"); echo "Error! invalid sek key"; die;
, 'title' => array('type' => 'text', 'size' => 127) , 'created_at' => array('type' => 'unixtime', 'default' => 'now', 'autosave' => true) , 'file' => array('type' => 'file', 'storage' => 'files', 'spacing' => 3) ); */ if (empty($_FILES['files']) || empty($_FILES['files']['size'])) { return; } $cmd_pid = core::lib('request')->get_ident('pid'); if (!$cmd_pid) { throw new controller_exception('Bad pid'); } $fh = $this->get_file_handle(); $f = $_FILES['files']; $fh->create(array('file' => $f, 'pid' => $cmd_pid)); // core::get_instance()->ajax_answer($fh->get_db()->get_last_query()); core::get_instance()->ajax_answer($fh->get_last_item()->render()); /* Array ( [files] => Array ( [name] => 1.txt [type] => application/octet-stream [tmp_name] => Q:\xampp\xampplite\tmp\php14F.tmp [error] => 0 [size] => 4 ) ) */
#!/usr/local/bin/php <?php /** * Cron entry point * * @package TwoFace * @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: cron.php,v 1.1.4.1.4.1 2009/01/27 17:55:51 surg30n Exp $ */ // if (empty($_SERVER['argv'])) die('Karamba!'); define('IN_CRONTAB', 'Here!'); define('IN_MAIN', 'Here!'); set_time_limit(0); require 'modules/core/loader.php'; // run crontab on single module if (empty($_SERVER['argv']) && !core::is_debug()) { die('Crontab direct access disabled'); } // force debug core::set_debug(666); ini_set('display_errors', 'on'); error_reporting(E_ALL); $module = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : false; core::get_instance()->crontab($module);
<?php /** * Sape interface * * @package TwoFace * @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: sape.php,v 1.2 2009/08/05 08:45:21 surg30n Exp $ */ $_su = core::get_instance()->get_cfg_var('sape_user'); if (!empty($_su)) { if (!defined('_SAPE_USER')) { define(_SAPE_USER, $_su); } require_once loader::get_root() . $_su . '/sape.php'; } if (!class_exists('SAPE_client')) { class SAPE_client { function SAPE_client($p = array()) { // mock core::dprint('[LIB_SAPE] Using mock', core::E_ERROR); } } } class sape extends SAPE_client { function __construct() {
function __construct() { $this->db = db_loader::get(db_loader::MOCK_CONNECTION, array('engine' => 'null')); $this->core = core::get_instance(); $this->prepare_fields(); }
* * @package TwoFace * @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: post_text.php,v 1.2 2008/05/22 07:58:07 surg30n Exp $ */ // template set up automatically // $this->set_template('user_cp/post_text'); if (!defined('IN_MAIN')) { die; } if (isset($post['post_submit'])) { $id = core::get_params('id'); if (empty($id)) { $cat_id = (int) $post['cat_id']; $category = $content->get_category($cat_id); if (!$category) { throw new controller_exception('Bad category in post submit'); } $data = array('faculty_id' => $category->pid, 'cat_id' => $category->id, 'title' => $post['title'], 'text' => $post['text'], 'owner_id' => $user->id); // approved? $data['b_approved'] = !$category->is_premoded() || $user->get_level() >= 50 ? true : false; $post_handle->modify($data); $new = $post_handle->get_item(); // core::var_dump($new->as_array()); core::get_instance()->set_raw_message('Submit'); } else { // probably modify? } // core::var_dump('submit'); }
/** * Moderator create/update method * context: users controller * * @package TwoFace * @author Golovkin Vladimir <*****@*****.**> http://www.skillz.ru * @copyright SurSoft (C) 2008 * @version $Id: mod.php,v 1.2 2008/05/23 15:02:37 surg30n Exp $ */ if (!defined('IN_MAIN')) { die; } $user = $this->get_user(); if ($user->level < $user->get_container()->get_level_by_name('mod')) { core::get_instance()->set_raw_message('restricted'); $this->set_null_template(); return false; } /* Вывод Очищаем и перезагружаем! */ $posts_base_url = $this->get_context()->get_cp_links('post'); $this->get_context()->set_cp_data('posts_base_url', $posts_base_url['url']); $cdata = core::module('content')->get_posts_handle(); $base_url = $this->get_context()->get_cp_links('mod'); $base_url = $base_url['url']; $page = $this->get_context()->get_core()->pagination(); $cdata->with_comments(false); $cdata->with_deps(false); $cdata_filter = new collection_filter($cdata, $base_url);
<?php require "../loader.php"; $i = core::get_instance()->class_register('test_images'); $i->create(array('image' => array('size' => 1, 'name' => '1.txt', 'tmp_name' => 'E:/1.txt'))); $item = $i->get_last_item(); var_dump($item->image, $item->render());