示例#1
0
文件: iframe.php 项目: Nazg-Gul/gate
 function iframe_editor($name, $innerHTML = '', $init = true, $handler_body = 'editor_form', $settings = array())
 {
     iframe_include_stuff();
     $res = tpl('back/iframe/form', array('name' => $name, 'innerHTML' => iframe_prepare_content($innerHTML), 'settings' => $settings));
     if ($init) {
         if (browser_engine() != 'DONKEY') {
             add_body_handler('onload', 'iframeEditor_Init', array('"' . $name . '"'));
         } else {
             $add = '<script language="JavaScript" type="text/javascript">' . 'iframeEditor_Init ("' . $name . '");</script>';
         }
     }
     handler_add($handler_body, 'onsubmit', 'iframeEditor_OnSubmit', array('"' . $name . '"'));
     return $res . $add;
 }
示例#2
0
 function Contest_ActionHandler()
 {
     global $act, $uid, $id, $pid;
     $full = content_url_get_full();
     if (!$this->GetAllowed('CONTEST.MANAGE')) {
         return;
     }
     if ($act == 'add') {
         $this->Contenst_AddProblemToContest($id, $uid);
     } else {
         if ($act == 'massadd') {
             $this->Contenst_MassAddProblemToContest($id, $uid);
         } else {
             if ($act == 'massdel') {
                 $this->Contenst_MassProblemDelete($id, $uid);
             } else {
                 if ($act == 'view') {
                     if (browser_engine() != 'DONKEY') {
                         $this->CPrintLn('<div id="view" style="margin-top: -6px; ' . 'padding-top: 6px;">');
                     } else {
                         $this->CPrintLn('<div id="view" style="_height: 1%;">');
                     }
                     $this->Problem_DrawDescription($uid, content_url_get_full());
                     $this->CPrintLn('</div>');
                 } else {
                     if ($act == 'up') {
                         $this->Problem_MoveUp($id, $pid);
                     } else {
                         if ($act == 'down') {
                             $this->Problem_MoveDown($id, $pid);
                         } else {
                             if ($act == 'drop') {
                                 $this->Problem_Drop($id, $pid);
                             } else {
                                 if ($act == 'rejudge') {
                                     $this->Problem_Rejudge($pid);
                                 } else {
                                     if ($act == 'delete') {
                                         $this->problemsContainer->Delete($pid);
                                     } else {
                                         if ($act == 'savegroups') {
                                             $this->Contest_UpdateRecievedGroupUsed($id);
                                         } else {
                                             if ($act == 'savecompilers') {
                                                 $this->Contest_UpdateRecievedCompilers($id);
                                             } else {
                                                 if ($act == 'togdis') {
                                                     $this->Contest_ToggleDisableProblem($id, $pid);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
示例#3
0
文件: builtin.php 项目: Nazg-Gul/gate
 function client_info()
 {
     global $HTTP_USER_AGENT;
     $browser = get_browser_cacheable();
     return array('realIP' => get_real_ip(), 'browserEngine' => browser_engine(), 'userAgent' => $_SERVER['HTTP_USER_AGENT']);
 }
示例#4
0
 function FieldsHTML()
 {
     $res = '';
     $res = swriteln($res, '<table class="form">');
     $n = count($this->fields);
     $engine = browser_engine();
     for ($i = 0; $i < $n; $i++) {
         $f = $this->fields[$i];
         $dummy = '';
         $dummy = $this->settings['titlewidth'] != '' ? ' width="' . $this->settings['titlewidth'] . '"' : ' width="30%"';
         if ($f['type'] != 'Custom') {
             $res = swriteln($res, '  <tr' . ($i == $n - 1 ? ' class="last"' : '') . '><td' . $dummy . '>' . $f['title'] . '</td><td>' . $this->FieldHTML($f) . '</td></tr>');
         } else {
             $res = swriteln($res, '</table>');
             $res = swriteln($res, '<table class="form">');
             $res = swriteln($res, '  <tr' . ($i == $n - 1 ? ' class="last"' : '') . '>' . ($f['value']['title'] != '' ? '<td ' . $dummy . ' valign="top">' . $f['value']['title'] . '</td>' : '') . '<td>' . $this->FieldHTML($f) . '</td></tr>');
             $res = swriteln($res, '</table>');
             $res = swriteln($res, '<table class="form">');
         }
     }
     $res = swriteln($res, '</table>');
     return $res;
 }
示例#5
0
文件: main.php 项目: Nazg-Gul/gate
 function CCore($url = '', $wiki = true)
 {
     global $DOCUMENT_ROOT, $content_type, $CORE, $ipc, $XPFS;
     debug_watchdog_clear();
     if ($url == '') {
         $url = config_get('document-root');
     }
     $this->wiki = $wiki;
     $this->URL = $url;
     $this->PAGE = new CVCPage();
     $this->PAGE->Init('title=GATE;');
     $CORE = $this;
     // Starting session
     session_start();
     // Set the internal encoding
     mb_internal_encoding(config_get('internal-charset'));
     // Connect to database
     db_connect(config_get('check-database'));
     // Initialize XPFS
     $XPFS = new XPFS();
     $XPFS->createVolume();
     // Initialize content stuff
     content_initialize();
     // Initialize wiki stuff
     wiki_initialize();
     // Initialie manage stuff
     manage_initialize();
     security_initialize();
     ipc_initialize();
     service_initialize();
     editor_initialize();
     $this->DeleteUnwanted();
     if ($ipc != '') {
         ipc_exec($ipc);
         die;
     } else {
         // Make default actions
         $this->ActionHandler();
         // Creating page
         $this->PAGE->AddStyle('content');
         $this->PAGE->AddStyle('pages');
         $this->PAGE->AddScript('language=JavaScript;type=text/javascript', "\n" . tpl('common/globals', array(), false));
         $this->PAGE->AddScriptFile('core.js');
         $this->PAGE->AddMeta('http-equiv=content-language;content=' . config_get('content-language'));
         $this->PAGE->AddMeta('name=url;content=' . config_get('meta-url'));
         $this->PAGE->AddMeta('name=keywords;content=' . config_get('meta-keywords'));
         $this->PAGE->AddMeta('name=description;content=' . config_get('meta-description'));
         $this->PAGE->AddMeta('http-equiv=Content-Type;content=text/html\\; charset\\=' . config_get('character-set'));
         $this->PAGE->AddMeta('name=robots;content=all');
         $this->PAGE->SetIcon(config_get('document-root') . '/pics/favicon.ico');
         add_body_handler('onmousemove', 'core_StoreMousePos', array('event'));
         if (browser_engine() == 'OPERA') {
             $this->PAGE->AddStyle('content_opera_rep');
         }
         foreach (config_get('default-scripts') as $k) {
             $this->AddScriptFile($k);
         }
     }
 }