/** * */ public static function __getInstance() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
/** * list servers * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // empty list if (!SQL::count($result)) { $output = array(); return $output; } // we return an array of ($url => $attributes) $items = array(); // process all items in the list while ($item = SQL::fetch($result)) { // initialize variables $prefix = $suffix = $icon = ''; // the url to view this item $url = Servers::get_url($item['id']); // use the title as a label $label = Skin::strip($item['title'], 10); // list all components for this item $items[$url] = array($prefix, $label, $suffix, 'server', $icon); } // end of processing SQL::free($result); return $items; }
/** * Add or Remove an order item to/from a server * * * @param integer $orderItemID * @param integer $serverID */ private static function doAddRemove($orderItemID, $serverID, $action = '') { $ret = false; if (is_numeric($orderItemID) && is_numeric($serverID) && ($action == 'add' || $action == 'remove')) { $serverID = intval($serverID); $itemID = intval($orderItemID); if ($action == 'remove') { $record = self::findByServerAndItem($serverID, $itemID); $record->delete(); $ret = true; } else { $order = OrdersItems::find($orderItemID, 'order_id', true); if (!empty($order) && is_array($order) && count($order) > 0) { $order = $order[0]; if (!isset($order['order_id']) || intval($order['order_id']) == 0) { $ret = false; } $orderID = intval($order['order_id']); $OrdersItemsServers = new self(); $OrdersItemsServers->server_id = $serverID; $OrdersItemsServers->order_id = $orderID; $OrdersItemsServers->orderitem_id = $itemID; $OrdersItemsServers->save(); $ret = true; } } // Always update server stats $Server = Servers::find($serverID); $Server->services = OrdersItemsServers::countByServerId($serverID); $Server->save(); return $ret; } return false; }
public function __construct($id) { $server = Servers::model()->findByPK($id); $http = new http(); $http->setTimeout(10); $this->moment = new moment($http, array('server_ip' => $server->ip, 'server_port' => $server->s_port, 'web_port' => $server->w_port)); }
/** * Save all the data * @param array $params */ public static function saveAll(array $params) { if (!empty($params['server_id']) && is_numeric($params['server_id'])) { $server = Doctrine::getTable('Servers')->find($params['server_id']); } else { $server = new Servers(); } $server->name = $params['name']; $server->ip = $params['ip']; $server->netmask = $params['netmask']; $server->host = $params['host']; $server->domain = $params['domain']; $server->description = $params['description']; $server->status_id = intval($params['status_id']); $server->isp_id = intval($params['isp_id']); $server->type_id = intval($params['type_id']); $server->panel_id = intval($params['panel_id']) ? intval($params['panel_id']) : null; $server->cost = isset($params['cost']) && is_numeric($params['cost']) ? $params['cost'] : 0; $server->max_services = isset($params['max_services']) ? intval($params['max_services']) : 0; $server->datacenter = isset($params['datacenter']) ? $params['datacenter'] : ''; $server->is_default = isset($params['is_default']) ? intval($params['is_default']) : 0; $server->buy_date = Shineisp_Commons_Utilities::formatDateIn($params['buy_date']); $server->save(); // TODO: clear other default servers for the same group. Only one server can be default in the group return $server['server_id']; }
public static function uptime($obj) { if ($obj->attemps > 0) { Servers::pure(round($obj->success / $obj->attemps * 100, 3) . ' %'); } else { echo 'Not checking yet'; } }
/** * list servers * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // empty list if (!SQL::count($result)) { $output = array(); return $output; } // we return an array of ($url => $attributes) $items = array(); // process all items in the list while ($item = SQL::fetch($result)) { // initialize variables $prefix = $suffix = $icon = ''; // the url to view this item $url = Servers::get_url($item['id']); // use the title as a label $label = Skin::strip($item['title'], 10); // flag files uploaded recently if ($item['edit_date'] >= $context['fresh']) { $prefix = NEW_FLAG . $prefix; } // description if ($item['description']) { $suffix .= ' ' . ucfirst(trim($item['description'])); } // the menu bar for associates and poster if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) { $menu = array(Servers::get_url($item['id'], 'edit') => i18n::s('Edit'), Servers::get_url($item['id'], 'delete') => i18n::s('Delete')); $suffix .= ' ' . Skin::build_list($menu, 'menu'); } // add a separator if ($suffix) { $suffix = ' - ' . $suffix; } // append details to the suffix $suffix .= BR . '<span class="details">'; // details $details = array(); // item poster if ($item['edit_name']) { $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])); } // the edition date $details[] = Skin::build_date($item['edit_date']); // all details if (count($details)) { $suffix .= ucfirst(implode(', ', $details)) . "\n"; } // end of details $suffix .= '</span>'; // list all components for this item $items[$url] = array($prefix, $label, $suffix, 'server', $icon); } // end of processing SQL::free($result); return $items; }
public function actionDelete() { if (Servers::model()->deleteByPk($_GET['id'])) { Yii::app()->user->setFlash('success', "Deleted!"); $this->redirect($this->createUrl("index")); } else { Yii::app()->user->setFlash('error', "Error!"); $this->redirect($this->createUrl("index")); } }
public function actionCreate() { $data = $_POST; // clean input here $data['application_id'] = trim($data['application_id']); $data['server_id'] = trim($data['server_id']); $data['application_path'] = trim($data['application_path']); $data['application_log'] = trim($data['application_log']); if (!empty($data)) { //FORM VALIDATION HERE $errors = array(); // server is required if (strlen($data['server_id']) == 0) { array_push($errors, 'SERVER_ERROR: Please choose a server'); // server chosen does not exist } else { if (!Servers::model()->exists('server_id=:server_id', array(':server_id' => $data['server_id']))) { array_push($errors, 'SERVER_ERROR: Server does not exist'); // server is taken } else { if (ApplicationServers::model()->findByPk(array('server_id' => $data['server_id'], 'application_id' => $data['application_id'])) != null) { array_push($errors, 'SERVER_ERROR: The application is already in this server'); // check if application is already in a server of the same type } else { if ($data['check_duplicate'] == 'true') { $duplicate_type = Servers::model()->findAll(array('join' => 'JOIN application_servers a ON t.server_id = a.server_id', 'condition' => 'a.application_id=:application_id AND t.server_type=:server_type', 'params' => array('application_id' => $data['application_id'], 'server_type' => $data['server_type']))); if (count($duplicate_type) != 0) { array_push($errors, 'DUPLICATE_ERROR: The application is already in a server of the same type.'); } } } } } //data is good if (count($errors) == 0) { $app_server = new ApplicationServers(); $app_server->application_id = $data['application_id']; $app_server->server_id = $data['server_id']; $app_server->application_path = $data['application_path']; $app_server->application_log = $data['application_log']; $app_server->date_created = date("Y-m-d H:i:s"); $app_server->date_updated = '0000-00-00 00:00:00'; $app_server->created_by = Yii::app()->user->name; $app_server->save(); echo CJSON::encode(array('type' => 'success', 'data' => '')); } else { echo CJSON::encode(array('type' => 'error', 'data' => implode(',', $errors))); } } else { echo CJSON::encode(array('type' => 'error', 'data' => 'CSRF_ERROR: CSRF Token did not match')); } }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Group name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'fill_type', array('label' => $translate->_('Fill type'), 'decorators' => array('Bootstrap'), 'class' => "form-control")); $this->getElement('fill_type')->setAllowEmpty(false)->setMultiOptions(array('1' => $translate->_('Create services on the least full server'), '2' => $translate->_('Fill default server until full then switch to next least used'), '3' => $translate->_('Fill servers starting from the newest to the older'), '4' => $translate->_('Fill servers starting from the older to the newest'), '5' => $translate->_('Fill servers randomly'), '6' => $translate->_('Fill manually. Only default server will be used.'), '7' => $translate->_('Fill servers starting from the cheaper to the expensive.'), '8' => $translate->_('Fill servers starting from the expensive to the cheaper.'))); $this->addElement('multiselect', 'servers', array('label' => $translate->_('Servers'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4')); $this->getElement('servers')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Servers::getServers()); $this->addElement('checkbox', 'active', array('label' => $translate->_('Active'), 'decorators' => array('Bootstrap'))); $this->addElement('hidden', 'group_id'); }
/** * list servers * * @param resource the SQL result * @return string the rendered text * * @see layouts/layout.php **/ function layout($result) { global $context; // empty list if (!SQL::count($result)) { $output = array(); return $output; } // we return an array of ($url => $attributes) $items = array(); // process all items in the list while ($item = SQL::fetch($result)) { // the url to view this item $url = Servers::get_url($item['id']); // use the title as a label $label = Skin::strip($item['title'], 10); // list all components for this item $items[$url] = array('', $label, ' ' . Skin::build_date($item['edit_date']), 'server', NULL); } // end of processing SQL::free($result); return $items; }
<?php class Servers extends DB_Accessor { public static $TableName = "gmd_servers"; public function Delete() { Database::Query("DELETE FROM `gmd_servers` WHERE `ID` = %s;", $this->GetValue("ID")); DB_Accessor::FlushMemCache("Servers"); } public static function AddServer($DisplayName, $IP, $Port) { // Make it in the database Database::Insert(self::$TableName, array("Name" => $DisplayName, "IP" => $IP, "Port" => $Port)); // Flush the cache DB_Accessor::FlushMemCache("Servers"); } } Servers::PrecacheAll("Servers");
<?php if (Servers::GetCacheCount("Servers") == 0) { KERNEL::OnError("You must first add a server before adding an item.", false); } else { if (isset($_FILES["itemImage"])) { $ImageURLName = "item_default.png"; // TODO -- Make this utilize the built in functionality of the Item class if (isset($_FILES["itemImage"])) { $File = $_FILES["itemImage"]; $FileExtension = end(explode(".", $File["name"])); $FileType = $File["type"]; $FileSize = $File["size"]; if (75000 < $FileSize) { // Too Big } elseif ($FileType != "image/png" && $FileType != "image/jpg" && $FileType != "image/jpeg") { // Bad Type } elseif ($FileExtension != "png" && $FileExtension != "jpg" && $FileExtension != "jpeg") { // Bad Extension } else { $ImageURLName = md5(rand()); move_uploaded_file($File["tmp_name"], "includes/images/uploaded/" . $ImageURLName . "." . $FileExtension); } } Database::Insert("gmd_items", array("Category" => intval($_POST["catID"]), "Name" => $_POST["itemName"], "Description" => $_POST["itemDesc"], "Cost" => floatval($_POST["itemCost"]), "Image" => $ImageURLName, "ShowImage" => !empty($_POST["showImage"]) ? 1 : 0, "Status" => ItemStatus::ACTIVE)); echo "<h4>You are being redirected..</h4>"; KERNEL::HardNavigate("admin", "&area=items"); } else { $CatObj = ItemCategory::GetByField("ItemCategory", "ID", $_GET["catid"]); ?>
iconAnchor: [15, 20], shadowAnchor: [15, 20], popupAnchor: [0, -10] } }); var buildind_icon = new LeafIcon({iconUrl: '/images/building_icon.png'}); var markers_cluster = new L.MarkerClusterGroup(); <?php $servers = array(); foreach ($myCams as $cam) { if (isset($servers[$cam->server_id])) { $server = $servers[$cam->server_id]; } else { $servers[$cam->server_id] = Servers::model()->findByPK($cam->server_id); $server = $servers[$cam->server_id]; } if (!$cam->show) { continue; } ?> cams_hashes["<?php echo $cam->id; ?> "] = {low:"<?php echo $cam->getSessionId(true); ?> ", server_ip:"<?php echo $server->ip;
<?php $server_types = ZHtml::enumItem(Servers::model(), 'server_type'); $select_types = array('' => '--Select Server Type--') + $server_types; ?> <div id="app-main-list" class="table-main" style="display:none";> <fieldset> <input type="hidden" id="app-main-list-csrf" value="<?php echo Yii::app()->request->csrfToken; ?> " /> <div class="table-header-block"> <div class="header-block-button"> <a id="app-main-list-create-button" class="button round blue image-right ic-add text-upper" href="#">Create Application</a> </div><!-- End Header Block Button --> <div class="header-block-side"> <div class="page-nav"> <div class="page-count"> <span class="current-page" id="app-main-list-part"></span> <span class="all-page" id="app-main-list-total"></span> </div> <div class="page-nav-arrow"> <a id="app-main-list-prev" class="prev" href="#" title="Previous"><span class="icon"></span></a> <a id="app-main-list-next" class="next" href="#" title="Next"><span class="icon"></span></a> </div> </div> </div><!-- End Header Block Side --> </div><!-- End Table Header Block -->
} // increment the post counter of the surfer Users::increment_posts(Surfer::get_id()); // do whatever is necessary on page publication if (isset($_REQUEST['publish_date']) && $_REQUEST['publish_date'] > NULL_DATE) { Articles::finalize_publication($anchor, $_REQUEST, $overlay, isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y', isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y'); // else do whatever is necessary on page submission } else { Articles::finalize_submission($anchor, $_REQUEST, $overlay); } // get the new item $article = Anchors::get('article:' . $_REQUEST['id'], TRUE); // list persons that have been notified $context['text'] .= Mailer::build_recipients('article:' . $_REQUEST['id']); // list endpoints that have been notified $context['text'] .= Servers::build_endpoints(i18n::s('Servers that have been notified')); // follow-up commands $follow_up = i18n::s('What do you want to do now?'); $menu = array(); $menu = array_merge($menu, array($article->get_url() => i18n::s('View the page'))); if (Surfer::may_upload()) { $menu = array_merge($menu, array('files/edit.php?anchor=' . urlencode('article:' . $_REQUEST['id']) => i18n::s('Add a file'))); } if ((!isset($_REQUEST['publish_date']) || $_REQUEST['publish_date'] <= NULL_DATE) && Surfer::is_empowered()) { $menu = array_merge($menu, array(Articles::get_url($_REQUEST['id'], 'publish') => i18n::s('Publish the page'))); } if (is_object($anchor) && Surfer::is_empowered()) { $menu = array_merge($menu, array('articles/edit.php?anchor=' . urlencode($anchor->get_reference()) => i18n::s('Add another page'))); } $follow_up .= Skin::build_list($menu, 'menu_bar'); $context['text'] .= Skin::build_block($follow_up, 'bottom');
$data['if']['noquery'] = false; $data['if']['server'] = false; include_once 'mods/servers/servers.class.php'; /* Get Server SQL-Data */ $select = 'servers_name, servers_ip, servers_port, servers_info, servers_query, servers_class, servers_slots, servers_stats, servers_order, servers_id'; $order = 'servers_order ASC'; $where = empty($id) ? '' : 'servers_id = \'' . $id . '\''; $cs_servers = cs_sql_select(__FILE__, 'servers', $select, $where, $order, 0, 0); $servers_count = count($cs_servers); /* if no Server in SQL */ if (empty($servers_count)) { unset($data['servers']); } else { $data['if']['server'] = true; /* Settings */ $objServers = Servers::__getInstance(); for ($run = 0; $run < $servers_count; $run++) { $server_query_ex = explode(";", $cs_servers[$run]['servers_class']); $cs_servers[$run]['servers_class'] = $server_query_ex[0]; $cs_servers[$run]['servers_game'] = $server_query_ex[0]; $data['servers'][$run]['info'] = $cs_servers[$run]['servers_info']; $data['servers'][$run]['if']['live'] = false; $data['servers'][$run]['mappic'] = 'uploads/servers/' . $cs_servers[$run]['servers_game'] . '/default.jpg'; $data['servers'][$run]['hostname'] = $cs_servers[$run]['servers_name']; $data['servers'][$run]['ip'] = $cs_servers[$run]['servers_ip']; $data['servers'][$run]['port'] = $cs_servers[$run]['servers_port']; $data['servers'][$run]['game'] = isset($server_query_ex[1]) ? $server_query_ex[1] : $server_query_ex[0]; $data['servers'][$run]['slots'] = $cs_servers[$run]['servers_slots']; $data['servers'][$run]['if']['playersexist'] = false; if (!empty($cs_servers[$run]['servers_stats'])) { $objServers->addServer(0, $cs_servers[$run]);
$label = sprintf(i18n::s('This server is allowed to submit monitoring requests (<code>monitor.ping</code>) at %s'), Skin::build_link('services/index.php#xml-rpc', i18n::s('the XML-RPC interface'), 'shortcut')); } else { $label = i18n::s('This server is not allowed to submit monitoring requests.'); } $text .= '<p>' . $label . "</p>\n"; // a section for the description if ($item['description']) { // display the full text $text .= Skin::build_block(i18n::s('Server description'), 'subtitle'); // show the description $text .= Skin::build_block($item['description'], 'description'); } $context['text'] .= $text; // insert anchor suffix if (is_object($anchor)) { $context['text'] .= $anchor->get_suffix(); } // test links if ($item['submit_feed'] == 'Y') { $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'test'), i18n::s('Test feed')); } // commands for associates if (Surfer::is_associate()) { $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'edit'), i18n::s('Edit')); $context['page_tools'][] = Skin::build_link(Servers::get_url($id, 'delete'), i18n::s('Delete')); } // referrals, if any $context['components']['referrals'] =& Skin::build_referrals(Servers::get_url($item['id'])); } // render the skin render_skin();
echo CHtml::submitButton($model->isNewRecord ? Yii::t('cams', 'Add') : Yii::t('cams', 'Save'), array('class' => 'btn btn-primary')); ?> </div> </div> <?php $this->endWidget(); ?> </div> </div> </div> </div> <?php if ($model->server_id) { $server = Servers::model()->findByPK($model->server_id); } if (Yii::app()->user->hasFlash('notify')) { $notify = Yii::app()->user->getFlash('notify'); ?> <div class="alert alert-<?php echo $notify['type']; ?> "><?php echo $notify['message']; ?> . <?php echo Yii::t('cams', 'Go to {user CP}', array('{user CP}' => CHtml::link(Yii::t('cams', 'personal cabinet'), $this->createUrl('cams/manage')))); ?> ?
/** * create or update a server entry * * This function is called when a remote server pings us, to mean its content has changed. * * If the provided URL does not exist, a new server profile is created. * Else the profile is updated only if ping is still allowed for this server profile. * * @see services/ping.php * * @param string the title of the updated server * @param string the link to it * @return string either a null string, or some text describing an error to be inserted into the html response */ public static function ping($title, $url) { global $context; // the entry already exists if ($item = Servers::get_by_url($url)) { // ensure this operation is allowed if (isset($item['process_ping']) && $item['process_ping'] != 'Y') { return 'You are not allowed to perform this operation.'; } // clear the cache for this server Cache::clear('server:' . $item['id']); // update the existing record $query = "UPDATE " . SQL::table_name('servers') . " SET " . "title='" . SQL::escape($title) . "', " . "edit_name='ping', " . "edit_id=0, " . "edit_address='', " . "edit_date='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'" . " WHERE id = " . SQL::escape($item['id']); if (SQL::query($query) === FALSE) { return 'ERROR'; } // the entry does not exist yet } else { // create a new record $query = "INSERT INTO " . SQL::table_name('servers') . " SET " . "title='" . SQL::escape($title) . "', " . "main_url='" . SQL::escape($url) . "', " . "edit_name='" . SQL::escape($title) . "', " . "edit_id=0, " . "edit_address='', " . "edit_date='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'"; if (SQL::query($query) === FALSE) { return 'ERROR'; } } // clear the cache for server profiles Cache::clear('servers'); // end of job return NULL; }
} } break; // ping an external reference to some page on this site // ping an external reference to some page on this site case 'weblogUpdates.ping': list($label, $url) = $parameters['params']; // caller has been banned if ($_SERVER['REMOTE_HOST'] && ($server = Servers::get($_SERVER['REMOTE_HOST']) && $server['process_ping'] != 'Y')) { $response = array('flerror' => 49, 'message' => 'Access denied'); } elseif (preg_match('/\\b(127\\.0\\.0\\.1|localhost)\\b/', $url)) { $response = array('flerror' => 1, 'message' => 'We don\'t accept local references ' . $url); } elseif (($content = http::proceed($url)) === FALSE && ($content = http::proceed($url . '/')) === FALSE) { $response = array('flerror' => 1, 'message' => 'Cannot read source address ' . $url); } else { $response = Servers::ping(strip_tags($label), $url); if ($response) { Logger::remember('services/ping.php: failing ping', $response, 'debug'); $response = array('flerror' => 1, 'message' => $response); } else { $response = array('flerror' => 0, 'message' => 'Thanks for the ping'); } } break; default: $response = array('faultCode' => 1, 'faultString' => 'Do not know how to process ' . $parameters['methodName']); Logger::remember('services/ping.php: ping unsupported methodName', $parameters, 'debug'); } } // no response yet if (!isset($response)) {
</a></div> <div class="server-banner"> <a href="/out?mode=server&id=<?php echo $server->id; ?> "> <img src="/static/images/banner.png"> </a> </div> <div class="server-content"> <table cellpadding="2"></span></td></tr> <tr><td>Версия</td> <td><span class="green"><?php echo Servers::version($server); ?> </span></td></tr> <tr><td>Whitelist</td> <td><span class="green"><?php echo Servers::whitelist($server); ?> </span></td></tr> <tr><td>Вход</td> <td><span class="green"><?php echo Servers::client($server); ?> </span></td></tr> <tr><td>Uptime</td> <td><span class="green"><?php echo Servers::uptime($server); ?> </span></td></tr> </tbody> </table> </div> </div>
// the title of the page $context['page_title'] = i18n::s('Ping the cloud'); // stop crawlers if (Surfer::is_crawler()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // anonymous users are invited to log in or to register } elseif (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode('servers/ping.php')); } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // do the ping } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ping') { // list servers to be advertised if ($servers = Servers::list_for_ping(0, 20, 'ping')) { $context['text'] .= '<p>' . i18n::s('Servers that have been notified') . '</p><ul>'; // ping each server foreach ($servers as $server_url => $attributes) { list($server_ping, $server_label) = $attributes; $milestone = get_micro_time(); $result = @Call::invoke($server_ping, 'weblogUpdates.ping', array(strip_tags($context['site_name']), $context['url_to_home'] . $context['url_to_root']), 'XML-RPC'); if ($result[0]) { $label = round(get_micro_time() - $milestone, 2) . ' sec.'; } else { $label = @$result[1]; } $context['text'] .= '<li>' . $server_label . ' (' . $label . ')</li>'; } $context['text'] .= '</ul>'; // no server to ping
// Yahoo! $link = 'http://search.yahoo.com/search?p=' . $search . '&ei=utf-8'; $text .= '<li>' . Skin::build_link($link, i18n::s('Yahoo!'), 'external') . '</li>'; // Ask Jeeves $link = 'http://web.ask.com/web?q=' . $search; $text .= '<li>' . Skin::build_link($link, i18n::s('Ask Jeeves'), 'external') . '</li>'; // in a separate panel $panels[] = array('extension', i18n::s('Extended search'), 'extensions_panel', $text); } // assemble all tabs if (count($panels)) { $context['text'] .= Skin::build_tabs($panels); } // search at peering sites, but only on unconstrained request and on first page include_once $context['path_to_root'] . 'servers/servers.php'; if (!$section_id && ($servers = Servers::list_for_search(0, 3, 'search'))) { // everything in a separate section $context['text'] .= Skin::build_block(i18n::s('At partner sites'), 'title'); // query each server foreach ($servers as $server_url => $attributes) { list($server_search, $server_label) = $attributes; // a REST API that returns a RSS list $result = Call::list_resources($server_search, array('search' => $search)); // error message if (!$result[0]) { $context['text'] .= $result[1]; } else { $items = array(); foreach ($result[1] as $item) { $suffix = ''; if ($item['description']) {
* * The response is a list of matching articles encoded with RSS. * Only public items are searched. * * @author Bernard Paques * @author GnapZ * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License * * @see search.php * @see services/rss_codec.php */ include_once '../shared/global.php'; // stop banned hosts include_once $context['path_to_root'] . 'servers/servers.php'; if (isset($_SERVER['REMOTE_HOST']) && ($server = Servers::get($_SERVER['REMOTE_HOST']) && $server['process_search'] != 'Y')) { exit('Access denied'); } // look for words $search = ''; if (isset($_REQUEST['search'])) { $search = $_REQUEST['search']; } elseif (isset($context['arguments'][0])) { $search = $context['arguments'][0]; } $search = strip_tags($search); // search type $type = ''; if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; }
foreach ($ActionArr["Arguments"] as $ArgObject) { echo $ArgObject->GenerateEditor($ItemActionData[$i]); $i++; } ?> <div class="row"> <div class="col-sm-6 col-md-4" style="text-align: right;line-height: 34px;"> <b>Servers</b> </div> <div class="col-sm-6 col-md-8" style="text-align: left;line-height: 34px;"> <div style="font-size: 12px;border: 1px solid #DDD;padding: 6px;width: 300px;border-radius: 4px;"> <?php $ServersArr = explode(";", $ItemAction->GetValue("Servers")); foreach (Servers::GetCachedResults("Servers") as $ServerObj) { $Checked = ""; foreach ($ServersArr as $ServerID) { if ($ServerObj->GetValue("ID") == intval($ServerID)) { $Checked = "checked"; } } echo '<input name="action_server_' . $ServerObj->GetValue("ID") . '" type="checkbox" ' . $Checked . ' /> ' . $ServerObj->GetValue("Name") . '<br />'; } ?> </div> </div> </div> <div class="row"> <div class="col-sm-6 col-md-4" style="text-align: right;line-height: 34px;">
/** * Set domain hosts (records) for a domain name. * * Executes the '...' command on Registrar's servers, to set domain hosts (records) * for a domain name that is active and belongs to your Ascio account. * * @param integer $domainID Domain code identifier * @return bool True if succeed and False if failed. * @access public * @see getDomainHosts */ function setDomainHosts($domainID) { $zonesrows = ""; $nserver = ""; // Connection to the SOAP system $soap = $this->Connect(); if (empty($this->session)) { throw new Exception('SOAP connection system error'); } // Get the domain information $domain = Domains::find($domainID); if (!empty($domain[0])) { $domain_name = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld']; $customer = Customers::find($domain[0]['customer_id']); } else { throw new Exception('Domain information has not found.'); } // Get the customer dns set in his control panel $NS = Dns_Zones::getCustomNameServers($domainID); // Get the default domain set $NSDefault = $soap->domainInfo($this->session['id'], $domain_name); // START NAMESERVER MANAGEMENT if (!empty($NS)) { // Get the client nameserver set in the shineisp control panel foreach ($NS as $ns) { $nameservers[] = $ns['target']; } } else { // Get the domain nameservers set in Ascio if (!empty($NSDefault->dns[0]) && !empty($NSDefault->dns[1])) { $nameservers[] = $NSDefault->dns[0]->name . "."; $nameservers[] = $NSDefault->dns[1]->name . "."; } else { // Get the common domain dns zones information set in shineisp preferences $NSDefault = Servers::getDnsserver(); foreach ($NSDefault as $ns) { $nameservers[] = $ns['host'] . "." . $ns['domain'] . "."; } } } // Create the NS records foreach ($nameservers as $ns) { $nameserver = array(); $nameserver[] = ""; $nameserver[] = " IN "; $nameserver[] = " NS "; $nameserver[] = $ns; $nserver .= implode("\t", $nameserver) . "\n"; } // END NAMESERVER MANAGEMENT if (!empty($nameservers[0])) { $zoneTemplate = "\$TTL 86400\n@ IN SOA " . $nameservers[0] . " tech.ascio.net. (2011022503 86400 3600 3600000 86400)\n"; // Get the domain dns zones information $dnsZones = Dns_Zones::getZones($domainID); // Create the DNS Zones records if (!empty($dnsZones)) { foreach ($dnsZones as $zone) { if ($zone['fieldtype'] != "NS") { // Exclude the NS because already included above $zones = array(); $zones[] = $zone['subdomain']; $zones[] = " IN "; $zones[] = $zone['fieldtype']; $zones[] = $zone['target']; $zonesrows .= implode("\t", $zones) . "\n"; } } $zones = array(); $zone = $zoneTemplate . $nserver . $zonesrows; } else { $webservers = Servers::getWebserver(); $mailservers = Servers::getMailserver(); // Set Web server zone $zones[] = "www\tIN\tCNAME\t" . $domain_name . "."; if (!empty($webservers['ip'])) { $zones[] = "\tIN\tA\t" . $webservers['ip']; } // Set mail zone $zones[] = "\tIN\tMX 1\tmail." . $domain_name . "."; if (isset($mailservers)) { $zones[] = "mail\tIN\tA\t" . $mailservers['ip']; } else { $zones[] = "mail\tIN\tA\t" . $webservers['ip']; } $zonesrows = implode("\n", $zones) . "\n"; $zone = $zoneTemplate . $nserver . $zonesrows; } // Reset of the Zone dns $soap->dnsReset($this->session['id'], $domain_name, 'REDIRECT', true); // Import the DNS Custom Zone $soap->zoneImport($this->session['id'], $domain_name, $zone); return true; } return false; }
public function create_newdir($srvid, $dir_name) { if (empty($dir_name)) { return 'No directory name given!'; } // Get network ID $result_nid = @mysql_query("SELECT netid FROM servers WHERE id = '{$srvid}'"); $row_nid = mysql_fetch_row($result_nid); $this_netid = $row_nid[0]; if (empty($this_netid)) { return 'Failed to get network ID!'; } require DOCROOT . '/includes/classes/network.php'; $Network = new Network(); $netinfo = $Network->netinfo($this_netid); // Get real server info require DOCROOT . '/includes/classes/servers.php'; $Servers = new Servers(); $srvinfo = $Servers->getinfo($srvid); $net_game_ip = $netinfo['game_ip']; $net_local = $netinfo['is_local']; $net_gameuser = $srvinfo[0]['username']; $net_game_port = $srvinfo[0]['port']; // Add full path to dir if (isset($_SESSION['curdir'])) { $dir_name = $_SESSION['curdir'] . '/' . $dir_name; } // Get userdir if ($net_local) { $localdir = DOCROOT . '/_SERVERS/'; $game_dir = $localdir . '/accounts/' . $net_gameuser . '/' . $net_game_ip . '.' . $net_game_port . '/' . $dir_name; // Check existing if (file_exists($game_dir)) { die('Sorry, that directory already exists!'); } // Create directory if (!mkdir($game_dir)) { return 'Failed to create the directory (' . $game_dir . ')!'; } else { return 'success'; } } else { // Save File $run_cmd = "CreateDirectory -u {$net_gameuser} -i {$net_game_ip} -p {$net_game_port} -d \"{$dir_name}\""; // Run the command, return output return $Network->runcmd($this_netid, $netinfo, $run_cmd, true, $srvid); } }
<tr style="text-align: left;"> <td><?php Servers::pure($server->name); ?> <hr></td> <td style="text-align: center">Work In Progress<hr><!--<a href="/server/<?php echo $server->id; ?> ">Страница сервера</a>--></td> <td style="text-align: center"><?php Servers::pure($server->address); ?> :<?php Servers::pure($server->port); ?> <hr></td> <td>Work In Progress<hr></td> <td>Work In Progress<hr></td> <td>Work In Progress<hr></td> <td>Work In Progress<hr></td> <td style="text-align: center"><?php Servers::pure($server->project); ?> <hr></td> </tr>
$fields = array(); $fields['host_name'] = i18n::s('www.yacs.fr'); if (Servers::get($fields['host_name'])) { $text .= sprintf(i18n::s('An entry already exists for server %s'), $fields['host_name']) . BR . "\n"; } else { $fields['title'] = 'yacs'; $fields['description'] = i18n::c('The origin server for the YACS system'); $fields['main_url'] = 'http://www.yacs.fr/'; $fields['submit_feed'] = 'Y'; $fields['feed_url'] = 'http://www.yacs.fr/feeds/rss.php'; $fields['submit_ping'] = 'Y'; $fields['ping_url'] = 'http://www.yacs.fr/services/ping.php'; $fields['submit_search'] = 'N'; $fields['search_url'] = 'http://www.yacs.fr/services/search.php'; $fields['submit_monitor'] = 'N'; $fields['monitor_url'] = 'http://www.yacs.fr/services/ping.php'; if ($error = Servers::post($fields)) { $text .= $error; } else { $text .= sprintf(i18n::s('A record has been created for server %s'), $fields['host_name']) . BR . "\n"; } } // report on actions performed if ($included) { echo $text; } else { $context['text'] .= $text; $menu = array('servers/' => i18n::s('Back to servers')); $context['text'] .= Skin::build_list($menu, 'menu_bar'); render_skin(); }