/** * Получение ID подкатегорий, если необходимо * @param array $curcats массив выбранных категорий * @return null */ protected function get_children(&$curcats) { if (!$this->settings['check_children']) { return; } /* @var $cats categories */ $cats = n("categories"); foreach ($curcats as $name => $cat) { $cat = explode('|', $cat); $c = count($cat); $ids = array(); for ($i = 0; $i < $c; $i++) { $ic = longval($cat[$i]); if (!$ic || !$cats->get($ic)) { continue; } $ids[] = $ic; $cats->get_children_ids($ic, $ids); } if (!$ids) { unset($curcats[$name]); continue; } $ids = array_unique($ids); $curcats[$name] = implode('|', $ids); } }
/** * Сохранение бота * @param array $data массив данных * @return null * @throws EngineException */ public function save($data) { $admin_file = globals::g('admin_file'); $cols = array('id', 'name', 'firstip', 'lastip', 'agent'); extract(rex($data, $cols)); $id = (int) $id; /* @var $etc etc */ $etc = n("etc"); $etc->get_ips($firstip, $lastip, true); if (!$name) { throw new EngineException('bots_empty_name'); } if (!$firstip && !$lastip && !$agent) { throw new EngineException('bots_empty_data'); } $update = array('name' => $name, 'firstip' => $firstip, 'lastip' => $lastip, 'agent' => $agent); try { plugins::o()->pass_data(array("update" => &$update, "id" => $id), true)->run_hook('admin_bots_save'); } catch (PReturn $e) { return $e->r(); } if (!$id) { db::o()->insert($update, 'bots'); log_add('added_bot', 'admin'); } else { db::o()->p($id)->update($update, 'bots', 'WHERE id=? LIMIT 1'); log_add('changed_bot', 'admin', $id); } furl::o()->location($admin_file); }
/** * Инициализация управления вложениями * @return null */ public function init() { /* @var $attach attachments */ $attach = n("attachments"); $act = $_GET["act"]; switch ($act) { case "upload": $type = $_GET["type"]; $toid = $_GET["toid"]; $ret = $attach->change_type($type)->upload($toid); ok(true); print $ret; break; case "download": $attach_id = (int) $_GET["id"]; $preview = (int) $_GET["preview"]; $attach->download($attach_id, $preview); break; case "delete": $attach_id = $_POST["id"]; $ret = $attach->delete($attach_id); if (!$ret) { throw new Exception(); } ok(); break; } die; }
function get_product_by_id($productid) { $s = q("select * from product where productid = '" . clean_query($productid) . "' limit 1;"); if (n($s) > 0) { return f($s); } return false; }
function get_bag_by_name($name) { $s = q("select * from bag where bag.name = '" . clean_query($name) . "';"); if (n($s) > 0) { return f($s); } return false; }
function get_user_by_username($username) { $s = q("select * from user where user.username = '******' limit 1;"); if (n($s) > 0) { return f($s); } return null; }
function get_family_by_id($clientid) { $s = q("select * from family, client where client.clientid = family.clientid and family.clientid = '" . clean_query($clientid) . "';"); if (n($s) > 0) { return f($s); } return null; }
/** * Функция вызова captcha * @return null */ public function init() { $background = 'include/backgrounds/' . $this->bckgrnds[rand(0, count($this->bckgrnds) - 1)]; $code = mb_strtoupper(users::o()->generate_salt(6)); if (!$_SESSION['captcha_key']) { $_SESSION['captcha_key'] = array(); } array_unshift($_SESSION['captcha_key'], $code); unset($_SESSION['captcha_key'][self::capacity]); /* @var $uploader uploader */ $uploader = n("uploader"); $uploader->watermark($background, $code, 'auto', false, '', 'cc', true, false); }
function baz($d) { $x = new D1(); $x = new D2(); $x = new D3(); $x = new D4(); $x = new D5(); $x = new D6(); $x = n($d . '1'); $x = n($d . '2'); $x = n($d . '3'); $x = n($d . '4'); $x = n($d . '5'); $x = n($d . '6'); $x = n('B1'); }
/** * Построение плагина * @param array $data массив данных * @return null * @throws EngineException */ public function build($data) { lang::o()->get('admin/plugins'); $data_params = array("plugin", "version", "author", "name", "descr", "comp", "comp_min", "comp_max"); extract(rex($data, $data_params)); if (!validword($plugin)) { throw new EngineException("plugins_invalid_name"); } $settings = modsettings::o()->make($data); $defaults = modsettings::o()->save(modsettings::nocache_id, $data); $vars = array($plugin, var_export((string) $version, true), var_export((string) $author, true), var_export((string) $name, true), var_export((string) $descr, true), var_export((string) $comp, true), var_export((string) $comp_min, true), var_export((string) $comp_max, true), var_export((array) $settings, true), $plugin, var_export((array) $defaults, true)); $contents = @file_get_contents(ROOT . self::plugin_template); $contents = vsprintf($contents, $vars); /* @var $uploader uploader */ $uploader = n("uploader"); $uploader->download_headers($contents, 'plugin.' . $plugin . '.php', 'text/plain'); }
/** * Инициализация Ajax-части нижнего блока * @return null */ public function init() { lang::o()->get("blocks/downm"); switch ($_GET["act"]) { case "content": users::o()->check_perms("content", 1, 2); $sticky = isset($_GET["sticky"]) ? (bool) $_GET["sticky"] : true; $this->show_content($sticky); break; case "comments": users::o()->check_perms('comment', 1, 2); /* @var $comments comments */ $comments = n("comments"); $comments->usertable(); break; default: users::o()->check_perms('profile', 1, 2); $this->show_online(); break; } }
/** * Инициализация рейтинга * @return null */ public function init() { $act = $_GET['act']; $type = $_POST['type']; $toid = $_POST['toid']; $this->rating = n("rating"); switch ($act) { case "vote": $value = $_POST['value']; $stype = $_POST['stype']; $stoid = $_POST['stoid']; $this->vote_to($type, $toid, $value, $stoid, $stype); break; case "get": $this->get($type, $toid); break; default: break; } ok(); }
function start_session_tracking() { session_start(); return true; clean_session_db(); error_reporting(E_ALL); $sessionhash = md5(get_session_id()); $idhash = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); // see: mysql.lib.php $s = q("select * from `session` where `hash` = '" . clean_query($sessionhash) . "' limit 1;"); if (n($s) == 0) { $s = q("insert into `session` values('', '0', '" . clean_query($sessionhash) . "', '" . clean_query($idhash) . "', '" . clean_query(time()) . "');"); if (a() == 1) { // success return true; } else { // failure return false; } } else { while ($r = f($s)) { //4c5b06225553e12bed914e6836ff4859 if ($r["identity"] != $idhash) { return false; } $s = q("update `session` set `activity` = '" . clean_query(time()) . "' where `hash` = '" . clean_query($sessionhash) . "' limit 1;"); return true; /*if (a() == 1) { // success return true; } else { // failure return false; }*/ } } return false; }
/** * Инициализация управления комментариями * @return null */ public function init() { $act = $_GET['act']; $this->comments = n("comments"); switch ($act) { case "edit": $id = longval($_POST['id']); $this->edit_form($id); break; case "add": case "edit_save": $content = $_POST['body']; $resid = longval($_POST['resid']); $type = $_POST['type']; $id = longval($_POST['id']); $this->save($content, $resid, $type, $id); ok(); break; case "show": $resid = longval($_POST['resid']); $type = $_POST['type']; $this->show($resid, $type); break; case "del": $id = (int) $_POST["id"]; $this->delete($id); ok(); break; case "quote": $id = (int) $_POST["id"]; $this->quote($id); die; default: break; } }
/** * Конструктор * @return null */ public function __construct() { $this->cats = n("categories"); }
/** * Show for PDF the current applicatif * * @param $pdf object for the output **/ function show_PDF($pdf) { global $DB; $pdf->setColumnsSize(50, 50); $col1 = '<b>' . sprintf(__('%1$s %2$s'), __('ID'), $this->fields['id']) . '</b>'; if (isset($this->fields["date_mod"])) { $col2 = sprintf(__('%1$s: %2$s'), __('Last update'), Html::convDateTime($this->fields["date_mod"])); } else { $col2 = ''; } $pdf->displayTitle($col1, $col2); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Name') . '</i></b>', $this->fields['name']), sprintf(__('%1$s: %2$s'), '<b><i>' . -n('Status', 'Statuses', 1) . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_states', $this->fields['states_id'])))); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Location') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_locations', $this->fields['locations_id']))), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Type') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_plugin_appliances_appliancetypes', $this->fields['plugin_appliances_appliancetypes_id'])))); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Technician in charge of the hardware') . '</i></b>', getUserName($this->fields['users_id_tech'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Environment', 'appliances') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_plugin_appliances_environments', $this->fields['plugin_appliances_environments_id'])))); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Group in charge of the hardware') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $this->fields['groups_id_tech']))), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Serial number') . '</i></b>', $this->fields['serial'])); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('User') . '</i></b>', getUserName($this->fields['users_id'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Inventory number') . '</i></b>', $this->fields['otherserial'])); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Group') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $this->fields['groups_id']))), ''); $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Associable to a ticket') . '</i></b>', Dropdown::getYesNo($this->fields['is_helpdesk_visible'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Item to link') . '</i></b>', Html::clean(PluginAppliancesRelation::getTypeName($this->fields['relationtype'])))); $pdf->displayText(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Comments') . '</i></b>', $this->fields['comment'])); $pdf->displaySpace(); }
function print_settle_group_list_html($settle_array) { //printr($settle_array); //printr($memberlist); foreach ($settle_array as $key => $value) { $pay_array[$value['pay_uid']][] = array("pay_name" => $value['pay_name'], "get_uid" => $value['get_uid'], "get_name" => $value['get_name'], "sum" => $value['sum']); } /* foreach($events as $key => $value) { $listhtml .= n(8) . "<li class=\"textbox\">" . $value['event_name'] . " (". $value['date'] . ")</li>\n"; } */ // $array = array_sort($array, 'balance', $order); // $count = count($array); //for ($i = 0; $i < $count; $i++) { // printr($pay_array); $listhtml = ""; foreach ($pay_array as $pay_uid => $get_array) { $listhtml .= n(6) . "<ul class=\"pageitem\">\n"; $listhtml .= n(8) . "<li class=\"textbox\"><span class=\"header\">" . $get_array[0]['pay_name'] . " pays:</span></li>\n"; $get_array = array_sort($get_array, 'sum', SORT_DESC); foreach ($get_array as $key => $value) { $listhtml .= n(8) . "<li class=\"menu\">\n"; $listhtml .= n(10) . "<span class=\"name\">" . $value['get_name'] . "</span>\n"; $listhtml .= n(10) . "<span class=\"balance\">\n"; $listhtml .= n(12) . "<span class=\"price_neg\">" . number_format($value['sum'], DECIMALS, DSEP, TSEP) . "</span>\n"; $listhtml .= n(12) . "<span class=\"euro_neg\">€</span>\n"; $listhtml .= n(10) . "</span>\n"; $listhtml .= n(8) . "</li>\n"; } $listhtml .= n(6) . "</ul>"; } echo $listhtml; }
</p> <a name="fee"></a> <h2>FOSS Factory's fee</h2> <p> FOSS Factory deducts a <?php echo conf("commission"); ?> % transaction fee from all bounty payments. This fee is separate from the community deduction. </p> <a name="disputes"></a> <h1><?php n(); ?> Disputes</h1> <p> Any registered member can file a complaint regarding the management of a project. When a complaint is filed, the project lead is notified, and must respond to the complaint. If the project lead responds by posting a counter-argument, then the plaintiff is notified and must follow up. The dispute can continue back and forth between the plaintiff and the project lead until one of the following occurs: </p> <ol> <li>The plaintiff opts to cancel the dispute; or</li> <li>On their turn, one or the other party chooses to finalize the discussion. In so doing, they forfeit their final opportunity to comment, thus granting
/** * Вход для конвертированного пользователя * @param array $data массив переменных * @return null * @throws PReturn */ public function converted_login($data) { $login = $data['login']; $password = $data['password']; $error =& $data['error']; $id =& $data['id']; /* @var $etc etc */ $etc = n("etc"); $u = $etc->select_user(null, $login, 'id,password,salt,converted'); if (!$u['converted']) { return; } $salt = $u['salt']; if ($u['password'] != md5($salt . $password . $salt)) { $error = lang::o()->v('login_false_signin'); return; } $id = $u['id']; $salt = users::o()->generate_salt(32); $password = users::o()->generate_pwd_hash($password, $salt); db::o()->p($id)->update(array('salt' => $salt, 'password' => $password, 'converted' => '0'), 'users', 'WHERE id = ? LIMIT 1'); throw new PReturn($password); }
$r .= n(116); $r .= e(); // Row 23 (top of tail) $r .= n(51); $r .= a(5, 13, 0); $r .= n(51); $r .= e(); // Row 24 $r .= n(53); $r .= a(5, 14, 23); $r .= n(53); $r .= e(); // Row (bottom of tail) $r .= n(55); $r .= a(5, 29, 24); $r .= n(55); $r .= '}' . PHP_EOL . '}'; echo $r; function n($count) { $r = ''; $e = '{-1,-1}, '; for ($i = 0; $i < $count; $i++) { $r .= $e; } return $r; } function a($pin, $start, $end) { $r = ''; if ($start > $end) {
<?php include_once dirname(__FILE__) . '/function.php'; // clear data $type = intval(v('type')); $url = z(v('url')); $desp = n(v('desp')); if ($type < 1 || strlen($url) < 1) { info_page('分享格式不正确'); } $data = array(); $data['type'] = $type; $data['link'] = $url; $data['time'] = date("Y-m-d H:i:s"); $data['desp'] = $desp; switch ($type) { case VIDEO: $info = parse_url($url); $data['video_domain'] = $info['host']; $cnname = '视频'; break; case MUSIC: $data['music_url'] = $url; $cnname = '音乐'; break; case WEBPAGE: $cnname = '网页'; break; } $data['uid'] = format_uid(); global $CI;
/** * Получение объекта класса * @return display $this */ public static function o() { if (!self::$o) { $cn = __CLASS__; $c = n($cn, true); self::$o = new $c(); } return self::$o; }
/** * Поиск в языковых пакетах * @param string $name имя языка * @param array $data массив данных * @return null * @throws EngineException */ protected function search($name, $data) { $cols = array('what' => 'search', 'where', 'regexp'); $data = rex($data, $cols); extract($data); $regexp = (bool) $regexp; if (!validfolder($name, LANGUAGES_PATH)) { throw new EngineException(); } if (!$what || mb_strlen($what) < 2) { throw new EngineException('nothing_selected'); } /* @var $search search */ $search = n("search"); $res = $search->search_infiles(LANGUAGES_PATH . '/' . $name, $what, $regexp, $where, array($this, "get")); tpl::o()->assign('row', $res); tpl::o()->assign('id', $name); $data['search'] = $data['what']; unset($data['what']); tpl::o()->assign('postdata', http_build_query($data)); tpl::o()->display('admin/languages/results.tpl'); }
<?php echo a('b' . $c->d, e($f->g == 'h' ? 'i' : 'j'), 'k') . 'l'; ?> M<?php echo n('o' . $p->q, r('s')); ?> T<?php echo u('v' . $w->x, y('z'), array('aa' => 'ab'));
?> </th> </tr> <?php foreach ($rates as $rate) { ?> <tr> <td> <strong><?php echo $this->e($rate['currency']); ?> </strong> </td> <td> <?php echo n($rate['rate']); ?> </td> </tr> <?php } ?> </table> <hr/> <h3><?php echo t('Change reference currency'); ?> </h3> <?php }
?> <tr> <td><?php echo dt('%B %e, %Y', strtotime($line['date'])); ?> </td> <td><?php echo n($line['in']); ?> </td> <td><?php echo n($line['out']); ?> </td> <td><?php echo n($line['left']); ?> </td> </tr> <?php } ?> </table> <?php } else { ?> <p class="alert"><?php echo t('There is not enough data to show something.'); ?> </p> <?php
?> <tr> <td><?php echo $this->url->link($this->text->e($record['task_title']), 'TaskViewController', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])); ?> </td> <td><?php echo $this->url->link($this->text->e($record['subtask_title']), 'TaskViewController', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])); ?> </td> <td><?php echo $this->dt->datetime($record['start']); ?> </td> <td><?php echo $this->dt->datetime($record['end']); ?> </td> <td><?php echo n($record['time_spent']) . ' ' . t('hours'); ?> </td> </tr> <?php } ?> </table> <?php echo $subtask_paginator; }
/** * Инициализация AJAX-части модуля * @return null */ public function init() { lang::o()->get('admin/pages/main'); if (!users::o()->perm('system')) { return; } $act = $_GET["act"]; users::o()->admin_mode(); /* @var $etc etc */ $etc = n("etc"); $all = false; switch ($act) { case "attachments": $all = true; case "unattachments": /* @var $attach attachments */ $attach = n("attachments"); $attach->clear(0, $all); break; case "sitemap": $this->sitemap(); ok(); break; case "cleanup": /* @var $cleanup cleanup */ $cleanup = n("cleanup"); $cleanup->execute(true); break; case "cache": cache::o()->clear(); break; case "cache_tpl": cache::o()->clear_tpl(); break; case "stats": $st = stats::o()->read(); foreach ($st as $s => $v) { stats::o()->write($s, 0); } break; case "logs": /* @var $logs logs_man_ajax */ $logs = plugins::o()->get_module('logs', 1, true); $logs->clear(); break; case "peers": db::o()->truncate_table('content_peers'); db::o()->update(array('leechers' => 0, 'seeders' => 0), 'content_torrents'); break; case "downloaded": db::o()->truncate_table('content_downloaded'); db::o()->update(array('downloaded' => 0), 'content_torrents'); break; case "chat": /* @var $chat chat */ $chat = plugins::o()->get_module('chat'); $chat->truncate(); break; case "pm": /* @var $pm messages_ajax */ $pm = plugins::o()->get_module('messages', false, true); $pm->clear(); break; case "ratings": $r = db::o()->query('SELECT toid, type FROM ratings GROUP BY toid, type'); /* @var $rating rating */ $rating = n("rating"); while ($row = db::o()->fetch_assoc($r)) { $rating->change_type($row['type'])->clear($row['toid']); } break; // Далее: Важная часть сайта, да // Далее: Важная часть сайта, да case "content": $r = db::o()->query('SELECT id FROM content'); while (list($id) = db::o()->fetch_row($r)) { try { $etc->delete_content($id); } catch (EngineException $e) { } } break; case "comments": /* @var $comments comments */ $comments = n("comments"); $comments->clear(null, true); break; case "polls": /* @var $polls polls */ $polls = n("polls"); $polls->clear(); break; case "news": /* @var $news news_ajax */ $news = plugins::o()->get_module('news', false, true); $news->clear(); break; case "bans": $r = db::o()->query('SELECT id FROM bans'); while (list($id) = db::o()->fetch_row($r)) { $etc->unban_user(null, $id); } break; case "warnings": $r = db::o()->query('SELECT id FROM warnings'); while (list($id) = db::o()->fetch_row($r)) { $etc->unwarn_user(null, null, $id); } break; } log_add('system_clean', 'admin', array(lang::o()->v('main_page_clear_' . $act), $act)); ok(); }
</th> </tr> <?php foreach ($metrics as $metric) { ?> <tr> <td> <?php echo $this->e($metric['user']); ?> </td> <td> <?php echo $metric['nb_tasks']; ?> </td> <td> <?php echo n($metric['percentage']); ?> % </td> </tr> <?php } ?> </table> </section> <?php }
/** * Удаление аватары пользователя * @param int $id ID пользователя * @param string $avatar значение поля vatar пользователя * @return null */ public function remove_user_avatar($id, $avatar) { /* @var $uploader uploader */ $uploader = n("uploader"); $avatar_name = display::avatar_prefix . $id; $aft = $uploader->filetypes('avatars'); if (preg_match('/^' . mpc($avatar_name) . '\\.(' . str_replace(";", "|", $aft['types']) . ')$/siu', $avatar)) { @unlink(ROOT . config::o()->v('avatars_folder') . "/" . $avatar); } }