function openqrm_dhcpd_appliance($cmd, $appliance_fields)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_EXEC_PORT;
    $openqrm_server = new openqrm_server();
    $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
    $event = new event();
    $appliance_id = $appliance_fields["appliance_id"];
    $appliance_name = $appliance_fields["appliance_name"];
    $resource = new resource();
    $resource->get_instance_by_id($appliance_fields["appliance_resources"]);
    $resource_mac = $resource->mac;
    $resource_ip = $resource->ip;
    $appliance = new appliance();
    $appliance->get_instance_by_id($appliance_id);
    if ($resource->id == "-1" || $resource->id == "") {
        return;
    }
    $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Handling {$cmd} event {$appliance_id}/{$appliance_name}/{$resource_ip}/{$resource_mac}", "", "", 0, 0, $resource->id);
    switch ($cmd) {
        case "start":
            $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Adding hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
            $dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance add_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
            $openqrm_server->send_command($dhcpd_command);
            break;
        case "stop":
            $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Removing hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
            $dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance remove_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
            $openqrm_server->send_command($dhcpd_command);
            break;
    }
}
Ejemplo n.º 2
0
function _range_panel(&$app, $c)
{
    global $lang;
    $p =& $app->ui;
    $def =& $app->db->def;
    $m = array('marker_field' => 'marker');
    $p->paragraph();
    # Link to creator of new record.
    $p->v->cursor->set_key('');
    $p->open_row();
    $e = new event('tk_range_edit_select', $m);
    $e->set_next($app->event());
    $p->submit_button('select range', $e);
    $sel = tk_range_edit_all_selected($app, 'marker');
    if ($sel == 0 || $sel == 2) {
        $e = new event('tk_range_edit_select', $m);
        $e->set_next($app->event());
        $p->submit_button('select all', $e);
    }
    if ($sel == 1 || $sel == 2) {
        $e = new event('tk_range_edit_unselect', $m);
        $e->set_next($app->event());
        $p->submit_button('select all', $e);
    }
    $e_delete = new event('record_delete');
    $e_delete->set_next($app->event());
    $e = new event('tk_range_edit_call', array('view' => $e_delete, 'argname' => 'id', 'marker_field' => 'marker'));
    generic_create($app, $c);
    if ($c->have_submit_button) {
        $p->cmd_update();
    }
    $p->close_row();
    $p->paragraph();
}
Ejemplo n.º 3
0
function category_overview(&$app)
{
    global $lang;
    $p =& $app->ui;
    $conf = new tree_edit_conf();
    $conf->source = 'directories';
    $conf->id = '1';
    $conf->treeview = $app->event();
    $conf->nodeview = 'view_pages';
    $conf->nodecreator = 'create_category';
    $conf->rootname = 'shop';
    $conf->table = 'directories';
    $conf->name = 'name';
    $conf->id = 'id';
    $conf->preset_values = array('id_directory_type' => get_directory_type_id($app->db, 'category'));
    $conf->txt_select_node = $lang['msg choose category to move'];
    $conf->txt_select_dest = $lang['msg choose dest category'];
    $conf->txt_moved = $lang['msg category moved'];
    $conf->txt_not_moved = $lang['err category not moved'];
    $conf->txt_move_again = $lang['cmd move further'];
    $conf->txt_back = $lang['cmd back/quit'];
    $conf->txt_unnamed = $lang['unnamed'];
    $e = new event('tree_edit_move', array('conf' => $conf));
    $e->set_caller($app->event());
    $p->link($lang['cmd move_category'], $e);
    tree_edit($app, $conf);
}
Ejemplo n.º 4
0
 public function callback(event $event)
 {
     $this->message = $event->click();
     if ($this->message instanceof process) {
         $this->message->process();
     }
 }
Ejemplo n.º 5
0
 /**
  * Store setting into database, in this case, use params field of plans table
  * @param event $row
  * @param Boolean $isNew true if create new plan, false if edit
  */
 function onAfterSaveSubscriptionPlan($row, $data, $isNew)
 {
     // $row of table EB_plans
     $params = new JRegistry($row->params);
     $params->set('mailchimp_list_ids', implode(',', $data['mailchimp_list_ids']));
     $row->params = $params->toString();
     $row->store();
 }
Ejemplo n.º 6
0
 public function notifyUntil(event $event)
 {
     $args = func_get_args();
     foreach ($this->getListeners($event->getName()) as $listener) {
         if (call_user_func_array($listener, $args)) {
             $event->setProcessed(true);
             break;
         }
     }
     return $event;
 }
Ejemplo n.º 7
0
 public function saveNewEvent()
 {
     Flight::auth()->check();
     $response = Flight::util()->validate('event', Flight::request()->data);
     if (is_array($response)) {
         Flight::util()->render('newEvent', array('team_id' => Flight::request()->data->team, 'error' => $response));
         return;
     }
     $event = new event(Flight::request()->data);
     $id = $event->store();
     Flight::redirect('/event/' . $id);
 }
Ejemplo n.º 8
0
 function _make_cmd($cmd, $label, $handler, $args)
 {
     global $lang;
     if (!$label) {
         $label = $lang["cmd {$cmd}"];
     }
     $this->open_row_and_cell();
     $e = new event(($this->no_update || $cmd == 'delete' ? 'record' : 'form') . "_{$cmd}");
     $e->set_next($this->make_event($handler, $args));
     $this->submit_button($label, $e);
     $this->close_cell_and_row();
 }
Ejemplo n.º 9
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $dataView = array();
     $dataView['page_title'] = "Eventos";
     $dataView['events'] = event::all();
     return view('event.index', $dataView);
 }
Ejemplo n.º 10
0
 /**
  * 删除所有定时
  */
 public static function delAll()
 {
     self::$_tasks = array();
     if (self::$_event) {
         self::$_event->clearAllTimer();
     }
 }
Ejemplo n.º 11
0
/**
 * Check if a version of this template exists in this theme or for the igb.
 * If client is igb check if theme has an igb version. If not check in default
 *  theme for one. If client is not igb check if the theme has the template.
 *  If not then again return the default template.
 *
 *  @param string $name containing the name of the template.
 */
function get_tpl($name)
{
    global $themename;
    event::call('get_tpl', $name);
    // If a specific tempate file is already asked for then simply return it.
    if (substr($name, -3) == 'tpl') {
        return $name;
    }
    if ($themename == 'default') {
        if (IS_IGB && file_exists('./themes/default/templates/igb_' . $name . '.tpl')) {
            return 'igb_' . $name . '.tpl';
        }
        return $name . '.tpl';
    } else {
        if (IS_IGB) {
            if (is_file('./themes/' . $themename . '/templates/igb_' . $name . '.tpl')) {
                return 'igb_' . $name . '.tpl';
            } else {
                if (is_file('./themes/default/templates/igb_' . $name . '.tpl')) {
                    return '../../default/templates/igb_' . $name . '.tpl';
                }
            }
        }
        if (is_file('./themes/' . $themename . '/templates/' . $name . '.tpl')) {
            return $name . '.tpl';
        } else {
            if (is_file('./themes/default/templates/' . $name . '.tpl')) {
                return '../../default/templates/' . $name . '.tpl';
            }
        }
    }
    return $name . '.tpl';
}
Ejemplo n.º 12
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $event = event::find($id);
     $input = Request::all();
     $event->update(['name' => $input['name']]);
     return redirect()->action('EventsController@index');
 }
Ejemplo n.º 13
0
 public function logout()
 {
     //
     Auth::logout();
     // logout user
     return Redirect::to('/')->with('events', event::all())->with('allDayEvent', allDayEvent::all());
     //redirect back to login
 }
Ejemplo n.º 14
0
 function batch_action(){
     if(front::post('batch') == 'delete'){
         $sql = "DELETE FROM `".config::get('database', 'prefix')."event`";
         $this->_table->query($sql);
         event::log('日志清除','成功');
         front::refresh(url::modify('act/manage',true));
     }
 }
Ejemplo n.º 15
0
 public static function lateProcess()
 {
     // let all mods know we're here so they can register their functions
     event::call('xajax_initialised', $this);
     // Also register this for old mods registered to the ajax mod.
     event::call('mod_xajax_initialised', $this);
     // now process all xajax calls
     global $xajax;
     $xajax->processRequest();
 }
Ejemplo n.º 16
0
 public function check()
 {
     if (!isset($this->_validate)) {
         // Initialize the validation object
         $this->_validate();
     }
     // add custom rules to $this->_validate();
     event::run('yuriko_core.model.validate.site_settings', $this->_validate);
     return parent::check();
 }
Ejemplo n.º 17
0
 public function postViewRule()
 {
     $input = Input::only('event_id');
     $event = event::find($input['event_id']);
     $errors = Events::EventWithRules($input);
     if ($errors) {
         return $errors;
     }
     $rules = $event->rules()->paginate(10);
     return $this->make('tableRulesForEvents', array('rules' => $rules));
 }
Ejemplo n.º 18
0
 public function execute($_options = array())
 {
     $array = utils::o2a($this);
     if (isset($_options['utid'])) {
         $array['utid'] = $_options['utid'];
     }
     if ($this->getLogicalId() == 'close') {
         event::add('clink::close', $array);
     } else {
         event::add('clink::open', $array);
     }
 }
 /**
  * Notification handler called when the request is being processed.
  * @param event $event the event
  **/
 function notify($event)
 {
     if ($event->get('soa_an')) {
         $entity = owa_coreAPI::entityFactory('ecoinsight.eco_core');
         $entity->load($event->get('guid'));
         if (!$entity->wasPersisted()) {
             $ret = $this->createEntity($event, $entity);
             $this->processOfflineClickEvent($event);
             $this->updateVisitor($event);
             if ($ret) {
                 return OWA_EHS_EVENT_HANDLED;
             } else {
                 owa_coreAPI::debug('Event failed to persist.');
                 return OWA_EHS_EVENT_FAILED;
             }
         } else {
             owa_coreAPI::debug('Event previously persisted.');
             return OWA_EHS_EVENT_HANDLED;
         }
     } else {
         owa_coreAPI::debug('No application name parameter.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
Ejemplo n.º 20
0
 public static function run()
 {
     global $xajax;
     if (isset($xajax)) {
         if (get_class($xajax) == 'xajax') {
             // we're good to go, set up our asynchronous callback
             $xuf = new xajaxUserFunction(array('ajcron', 'ajcron', 'xajax_req'), null);
             $xajax->register(XAJAX_FUNCTION, $xuf);
             // fastest way to check wether we have to run or not
             if (config::get('ajcron_nextrun') < time()) {
                 // we need to run
                 mod_xajax::xajax();
                 $xajax->configure('waitCursor', false);
                 event::register('page_assembleheader', 'ajcron::insertHTML');
             }
         }
     }
 }
Ejemplo n.º 21
0
 function action()
 {
     $event = new event();
     $identifier = $this->response->html->request()->get($this->identifier_name);
     $msg = '';
     if ($identifier !== '') {
         foreach ($identifier as $id) {
             $event->get_instance_by_id($id);
             if ($event->priority == 9 && $event->source === 'License') {
                 continue;
             }
             $fields = array();
             $fields["event_status"] = 1;
             $event->update($id, $fields);
             $msg .= sprintf($this->lang['msg'], $id) . '<br>';
         }
     }
     $this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
 }
Ejemplo n.º 22
0
 /**
  * Assemble the page and return the HTML.
  *
  * @return string
  */
 function assemble()
 {
     event::call('pageAssembly_assemble', $this);
     $output = '';
     foreach ($this->assemblyQueue as $id => $object) {
         usort($object['addBefore'], array(&$this, 'prioSortHelper'));
         foreach ($object['addBefore'] as $callback) {
             $output .= $this->call($callback['callback']);
         }
         $text = $this->call($object['callback']);
         foreach ($object['filter'] as $callback) {
             $text = $this->callFilter($callback['callback'], $text);
         }
         $output .= $text;
         foreach ($object['addBehind'] as $callback) {
             $output .= $this->call($callback['callback']);
         }
     }
     return $output;
 }
Ejemplo n.º 23
0
 /**
  * Import data from a file
  *
  * @param   array  $file
  * @return  array
  */
 public function onImport($file, $scope = NULL, $scope_id = NULL)
 {
     //array of acceptable file types
     $acceptable = array('txt');
     //get the file extension
     $extension = $file->getClientOriginalExtension();
     //only process acceptable files
     if (!in_array($extension, $acceptable)) {
         return;
     }
     //get the file contents, uses temporary file
     $raw_contents = file_get_contents($file->getFilename());
     //check to see if this is endnote content
     if (preg_match('/%A|%0|%T/', $raw_contents)) {
         //make new file to pass to dispatcher
         $new_file = array('name' => $file->getClientOriginalName() . '.enw', 'type' => $file->getType(), 'tmp_name' => $file->getName(), 'error' => $file->getError(), 'size' => $file->getClientSize());
         $return = event::trigger('citation.onImport', array($new_file), $scope, $scope_id);
         return $return[0];
     }
 }
Ejemplo n.º 24
0
 function event($request, $keyword)
 {
     switch ($request) {
         case 'all':
             $result = event::search($keyword);
             break;
         case '':
             $result = event::search($keyword);
             break;
         case 'academic':
             $result = event::search_academic($keyword);
             break;
         case 'study':
             $result = event::search_study($keyword);
             break;
         case 'papers':
             break;
             break;
     }
     return $result;
 }
Ejemplo n.º 25
0
 public function actionView($id)
 {
     $model = event::find()->where(['id' => $id])->one();
     if (is_null($model)) {
         // 404 HTTP status will be returned
         throw new \yii\web\NotFoundHttpException();
     }
     /*
      * Количество просмотров считается отдельно для русской и отдельно для английской версии
      */
     $Event_ru = Event_ru::find()->where(['event_id' => $id])->one();
     $Event_en = Event_en::find()->where(['event_id' => $id])->one();
     if (Yii::$app->language == 'en') {
         $Event_en->visited++;
         $Event_en->save();
     } elseif (Yii::$app->language == 'ru') {
         $Event_ru->visited++;
         $Event_ru->save();
     }
     $photos = event_photo::find()->where(['event_id' => $id])->all();
     //$photos = events_Photo::find(array('events_id' => $id));
     return $this->render('view', ['model' => $model, 'photos' => $photos]);
 }
Ejemplo n.º 26
0
 /**
  * Register a callback for an event. Callbacks are of the form
  * array('Class', 'Method');
  *
  * @param string $event Event name.
  * @param array $callback Callback to be called when the event is triggered
  *
  * @return boolean True on success, false on failure. 
  */
 public static function register($event, $callback)
 {
     if (is_array($callback)) {
         if (is_object($callback[0])) {
             trigger_error('The supplied callback has to point to a static method.', E_USER_WARNING);
             return false;
         }
     } else {
         if (!strpos($callback, '::')) {
             trigger_error('The supplied callback "' . $callback . '" has to point to a static method.', E_USER_WARNING);
             return false;
         } else {
             // Accept callback in string form 'Class::method' for legacy events.
             $callback = explode('::', $callback);
         }
     }
     if (!is_callable($callback, false, $callable_name)) {
         trigger_error('The stored event handler "' . $event . '" is not callable (CB: "' . join("::", $callback) . '").', E_USER_WARNING);
         return false;
     }
     event::_put($event, $callback);
     return true;
 }
Ejemplo n.º 27
0
 /**
  * Add a comment to a kill.
  *
  * The kill id is set when the Comments object is constructed.
  * @param string $name The name of the comment poster.
  * @param string $text The text of the comment to post.
  */
 function addComment($name, $text)
 {
     $comment = $this->bbencode(trim($text));
     $name = trim($name);
     $qryP = new DBPreparedQuery();
     $sql = "INSERT INTO kb3_comments (`kll_id`,`site`, `comment`,`name`,`posttime`, `ip`)\n                       VALUES (?, ?, ?, ?, ?, ?)";
     $qryP->prepare($sql);
     $site = KB_SITE;
     $date = kbdate('Y-m-d H:i:s');
     $ip = logger::getip();
     $params = array('isssss', &$this->id_, &$site, &$comment, &$name, &$date, &$ip);
     $qryP->bind_params($params);
     $qryP->execute();
     $id = $qryP->getInsertID();
     $this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 'name' => $name, 'comment' => $comment, 'id' => $id);
     // create comment_added event
     event::call('comment_added', $this);
 }
Ejemplo n.º 28
0
require_once "{$RootDir}/class/openqrm_server.class.php";
// filter inputs
require_once $RootDir . '/class/htmlobjects/htmlobject.class.php';
require_once $RootDir . '/include/requestfilter.inc.php';
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
global $IMAGE_INFO_TABLE;
global $DEPLOYMENT_INFO_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
// get params
$lcmc_command = $request->get('lcmc_command');
$lcmc_resource_id = $request->get('resource_id');
$lcmc_resource_ip = $request->get('resource_ip');
// get event + openQRM server
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
    $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "lcmc-action", "Un-Authorized access to lcmc-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
    exit;
}
$event->log("{$lcmc_command}", $_SERVER['REQUEST_TIME'], 5, "lcmc-action", "Processing lcmc command {$lcmc_command}", "", "", 0, 0, 0);
switch ($lcmc_command) {
    default:
        $event->log("{$lcmc_command}", $_SERVER['REQUEST_TIME'], 3, "lcmc-action", "No such lcmc command ({$lcmc_command})", "", "", 0, 0, 0);
        break;
}
Ejemplo n.º 29
0
 function edit($template)
 {
     // cache output
     ob_start();
     require_once $this->openqrm->get('webdir') . '/class/htmlobjects/htmlobject.response.class.php';
     $response = new htmlobject_response($this->response->html, $this->response->id);
     $response->html->debug();
     require_once $this->openqrm->get('basedir') . '/plugins/development/web/class/dummyuser.class.php';
     $dummy = new dummyuser('xxx');
     require_once $this->openqrm->get('basedir') . '/web/base/class/openqrm.class.php';
     $oq = new openqrm($this->file, $dummy, $response);
     if ($this->response->html->request()->get('plugin_name') !== '') {
         $path = $this->rootdir . '/plugins/' . $this->response->html->request()->get('plugin_name') . '/web/class/';
     }
     if ($this->response->html->request()->get('base_name') !== '') {
         if ($this->response->html->request()->get('base_name') !== 'plugins') {
             $path = $this->rootdir . '/web/base/server/' . $this->response->html->request()->get('base_name') . '/class/';
         } elseif ($this->response->html->request()->get('base_name') === 'plugins') {
             $path = $this->rootdir . '/web/base/plugins/aa_plugins/class/';
         }
     }
     $files = $this->file->get_files($path);
     $name = array();
     $objs = array();
     if (is_array($files)) {
         foreach ($files as $file) {
             if (strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) {
                 require_once $file['path'];
                 $class = str_replace('.class.php', '', $file['name']);
                 $class = str_replace('.', '_', $class);
                 $class = str_replace('-', '_', $class);
                 $class = new $class($oq, $response->response());
                 $objs[] = $class;
                 $name[] = str_replace('.controller.class.php', '', $file['name']);
             }
         }
     }
     $content = array();
     $i = 0;
     foreach ($objs as $obj) {
         $content[$i]['name'] = $name[$i];
         $content[$i]['object'] = $obj;
         $content[$i]['class'] = get_class($obj);
         if (get_class_methods($obj)) {
             $content[$i]['methods'] = get_class_methods($obj);
         } else {
             $content[$i]['methods'] = '';
         }
         $content[$i]['vars'] = get_class_vars(get_class($obj));
         $i++;
     }
     if ($this->response->html->request()->get('plugin_name') !== '') {
         $controllers = '<div class="plugin"><div class="name">plugin=' . $this->response->html->request()->get('plugin_name') . '</div>';
     } else {
         if ($this->response->html->request()->get('base_name') !== '') {
             $controllers = '<div class="plugin"><div class="name">base=' . $this->response->html->request()->get('base_name') . '</div>';
         }
     }
     $legend = '';
     if (count($content) > 0) {
         $tpldir = dirname($path) . '/tpl/';
         $files = $this->file->get_files($tpldir);
         $legend = '<div class="legend">';
         $legend .= '<div><div class="plugin" style="display: inline;padding: 5px;line-height:0px;margin:0px;font-size:0px;">&#160;</div> = Plugin</div>';
         $legend .= '<div><div class="controller" style="display: inline;padding: 5px;line-height:0px;margin:0px;font-size:0px;">&#160;</div> = Controller</div>';
         $legend .= '<div><div class="action" style="display: inline;padding: 5px;line-height:0px;margin:0px;font-size:0px;">&#160;</div> = Action</div>';
         $legend .= '</div>';
         foreach ($content as $con) {
             $controllers .= '<div class="controller">';
             foreach ($con as $k => $v) {
                 if ($k === 'name') {
                     $controllers .= '<div class="name">controller=' . $v . '</div>';
                 }
                 if ($k === 'methods') {
                     if (is_array($v)) {
                         $controllers .= '<div class="methods">';
                         $i = 0;
                         foreach ($v as $value) {
                             $css = '';
                             if (!in_array($value, $this->methods) && strpos($value, '__') === false && stripos($value, 'reload') === false) {
                                 // handle duplicate
                                 if ($value === 'duplicate') {
                                     $value = 'clone';
                                 }
                                 $file = $con['name'] . '.' . str_replace('_', '-', $value) . '.class.php';
                                 if ($this->file->exists($path . $file)) {
                                     $css = 'action';
                                     if ($i === 0) {
                                         $i++;
                                         $css = 'action first';
                                     }
                                     $controllers .= '<div class="' . $css . '"><span>' . $value . '</span><br>';
                                     require_once $path . $file;
                                     $class = str_replace('.class.php', '', $file);
                                     $class = str_replace('.', '_', $class);
                                     $class = str_replace('-', '_', $class);
                                     $tpl = str_replace('_', '-', $class) . '.tpl.php';
                                     if (!$this->file->exists($tpldir . $tpl)) {
                                         $tpl = '<div><b class="error">ERROR:</b> missing template ' . $tpl . '</div>';
                                     } else {
                                         foreach ($files as $key => $file) {
                                             if ($file['name'] === $tpl) {
                                                 unset($files[$key]);
                                             }
                                         }
                                         $tpl = '<div><b class="success">PASSED:</b> found template ' . $tpl . '</div>';
                                     }
                                     $controllers .= $tpl;
                                     /*
                                     
                                     										$class = new $class($oq, $con['object']->response->response(), $con['object']);
                                     										$class->tpldir = dirname($path).'/tpl/';
                                     										// check vars
                                     										#$this->__check_action_vars($class, $con, $value);
                                     										// check lang
                                     										if(isset($con['object']->lang[$value])) {
                                     											$class->lang = $con['object']->lang[$value];
                                     										} else {
                                     											$class->lang = $con['object']->lang;
                                     										}
                                     
                                     										$x = new ReflectionObject($class);
                                     										if($x->hasMethod('action')) {
                                     
                                     
                                     											$controllers .= $class->action()->get_string();
                                     
                                     
                                     
                                     											if($str !== '') {
                                     												$controllers .= '<div class="params"><b>Params</b>';
                                     												$controllers .= $str;
                                     												$controllers .= '</div>';
                                     												if($this->response->html->request()->get('plugin_name') !== '') {
                                     													$p = $this->response->html->request()->get('plugin_name');
                                     													$tag = 'plugin';
                                     												}
                                     												else if($this->response->html->request()->get('base_name') !== '') {
                                     													$p = $this->response->html->request()->get('base_name');
                                     													$tag = 'base';
                                     												}
                                     												$controllers .= '<div class="link"><b>Link:</b> ?'.$tag.'='.$p.'&amp;controller='.$con['name'].'&amp'.implode('&amp;', $url).'</div>';
                                     											}
                                     
                                     
                                     											$params = $x->getMethod('get_response')->getParameters();
                                     											$res = $class->get_response();
                                     											if(isset($res->form)) {
                                     												$str = '';
                                     												$elem = $res->form->get_elements();
                                     												if(is_array($elem) && count($elem) > 0) {
                                     													foreach($elem as $key => $e) {
                                     														if($e instanceof htmlobject_box) {
                                     															// check elements name
                                     															if(isset($e->__elements[0]->name) && $e->__elements[0]->name !== '') {
                                     																$required = '';
                                     																if(isset($res->form->__data[$key]['required'])) {
                                     																	$required = ' *';
                                     																}
                                     																$regex = '';
                                     																if(isset($res->form->__data[$key]['validate']['regex'])) {
                                     																	$regex = ' ('.$res->form->__data[$key]['validate']['regex'].')';
                                     																}
                                     																$str .= '<span>'.$e->__elements[0]->name.$required.$regex.'</span>';
                                     																$url[] = $e->__elements[0]->name.'=..';
                                     															}
                                     														} else {
                                     															if(isset($e->name) && $e->name !== $con['vars']['actions_name']) {
                                     																if($key !== 'submit' && $key !== 'cancel') {
                                     																	$str .= '<span><strong>'.$e->name.'</strong></span>';
                                     																	$url[] = $e->name.'=..';
                                     																} else {
                                     																	$str .= '<span><i>'.$e->name.'</i></span>';
                                     																	if($key !== 'cancel') {
                                     																		$url[] = $e->name.'=submit';
                                     																	}
                                     																}
                                     															}
                                     														}
                                     													}
                                     													if($str !== '') {
                                     														$controllers .= '<div class="params"><b>Params</b>';
                                     														$controllers .= $str;
                                     														$controllers .= '</div>';
                                     														if($this->response->html->request()->get('plugin_name') !== '') {
                                     															$p = $this->response->html->request()->get('plugin_name');
                                     															$tag = 'plugin';
                                     														}
                                     														else if($this->response->html->request()->get('base_name') !== '') {
                                     															$p = $this->response->html->request()->get('base_name');
                                     															$tag = 'base';
                                     														}
                                     														$controllers .= '<div class="link"><b>Link:</b> ?'.$tag.'='.$p.'&amp;controller='.$con['name'].'&amp'.implode('&amp;', $url).'</div>';
                                     													}
                                     												}
                                     											}
                                     										} else {
                                     											$elem = $class->response->params;
                                     											if(is_array($elem) && count($elem) > 0) {
                                     												$str = '';
                                     												foreach($elem as $key => $e) {
                                     													$str .= '<span><strong>'.$key.'</strong></span>';
                                     												}
                                     												if($str !== '') {
                                     													$controllers .= '<div class="params"><b>Params</b>';
                                     													$controllers .= $str;
                                     													$controllers .= '</div>';
                                     												}
                                     											}
                                     										}
                                     */
                                     $controllers .= '</div>';
                                 } else {
                                     $GLOBALS['error_action'][] = '<div><b class="error">ACTION_ERROR:</b> missing file <b>' . $file . '</b> for action ' . $value . '</div>';
                                 }
                             }
                         }
                         $controllers .= '</div>';
                     }
                 }
             }
             $controllers .= '</div>';
         }
         // supernumerous files
         foreach ($files as $file) {
             if (strripos($file['name'], 'about') === false) {
                 $GLOBALS['error_action'][] = '<div><b class="error">TEMPLATE_NOTICE: </b> Found supernumerous file ' . $file['name'] . '</div>';
             }
         }
         $controllers .= '</div>';
     } else {
         $oop = false;
         foreach ($files as $file) {
             if (strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') !== false) {
                 $oop = true;
                 $controllers = '<div>Plugin ' . $this->response->html->request()->get('plugin_name') . ' is about controller only</div>';
                 break;
             }
         }
         if ($oop === false) {
             $controllers = '<div>Plugin ' . $this->response->html->request()->get('plugin_name') . ' is not OOP</div>';
         }
     }
     $template->add($controllers, 'controllers');
     $template->add($legend, 'legend');
     // handle errors
     $phpinfo = '';
     if ($this->response->html->request()->get('debug') !== '') {
         if (isset($GLOBALS['error_controller']) && count($GLOBALS['error_controller']) > 0) {
             $phpinfo .= implode('', $GLOBALS['error_controller']);
         }
         if (isset($GLOBALS['error_action']) && count($GLOBALS['error_action']) > 0) {
             $phpinfo .= implode('', $GLOBALS['error_action']);
         }
         if (isset($GLOBALS['error_php']) && count($GLOBALS['error_php']) > 0) {
             $phpinfo .= implode('', $GLOBALS['error_php']);
         }
         $messages = trim(ob_get_contents());
         if ($messages !== '') {
             $phpinfo .= '<b>HTMLOBJECTS DEBUG:</b><br>' . $messages;
         }
     }
     // end cache
     ob_end_clean();
     if ($phpinfo !== '') {
         $phpinfo = '<div class="phpinfobox">' . $phpinfo . '</div>';
     } else {
         $phpinfo = '&#160;';
     }
     $template->add($phpinfo, 'phpinfo');
     $template = $this->controller->__get_navi($template, 'template');
     // event cleanup, some methods creating events if constructed without parameters
     $event = new event();
     $event->remove_by_description('Could not create instance of');
     return $template;
 }
Ejemplo n.º 30
0
 /**
  * @brief Main router entry point
  *
  * Override this in your router to get full control over the way the
  * request is being fed to the router class.
  *
  * @return Mixed The result from the routerequest call
  */
 public function route()
 {
     Console::debugEx(LOG_VERBOSE, __CLASS__, 'Looking for event handlers before routing');
     // Invoke events first to see if anything is registered
     if (event::invoke(MvcEvent::EVENT_BEFORE_ROUTING, array('uri' => $this->_uri, 'segments' => $this->_urisegments, 'domain' => $this->_domain, 'secure' => $this->_secure)) == true) {
         return 0;
     }
     Console::debugEx(LOG_VERBOSE, __CLASS__, 'Examining static routes');
     // Determine if this is a hooked uri
     foreach (Router::$_staticroutes as $sr) {
         if (@preg_match('/' . $sr['match'] . '/', $this->_uri, $ret)) {
             call_user_func_array($sr['hook'], array_slice($ret, 1));
             return 0;
         }
     }
     Console::debugEx(LOG_VERBOSE, __CLASS__, 'Invoking the router');
     // Invoke the router
     return $this->routeRequest($this->_uri);
 }