function testRemovePage() { $this->CI->load->model('script'); $script = new Script($this->DBI); $script->setKey(1); $script->retrieve(); $this->assertTrue(count($script->pages->getPageKeys()) === 2, 'Test page group retrieves as expected'); }
public static function obfuscateMailTo($string, Script $script) { $script->link(JS_DIR . 'mail.js'); preg_match_all(self::MAIL_REGEX, $string, $matches); foreach ($matches[0] as $m) { $string = str_replace($m, base64_encode(str_rot13(trim($m))), $string); } return $string; }
/** * Takes a request for a image in scriptNum-pageNum.jpg format - to allow caching */ protected function page() { $this->load->model('script'); $script = new Script(); $imageFileRequested = $this->uri->segment(4); $splitAroundPipe = explode('-', $imageFileRequested); $scripNum = $splitAroundPipe[0]; $splitOnFullstop = explode('.', $splitAroundPipe[1]); $pageNum = $splitOnFullstop[0]; $script->retrieve($scripNum); $pageFile = $script->pages->getPageKeyAt((int) $pageNum); $this->_outputPage($pageFile); }
/** * * Takes a request for a image in "scriptNum-pageNum.jpg" format - to allow caching; Modified method for demo.. * Modified - enforced white list for demo * @param "$scriptNum-$pageNum.jpg" in 4th url segment */ public function page() { $this->load->model('script'); $script = new Script(); // CHECK THIS IS CORRECT FOR THE CURRENT CONTROLLER LOCATION $imageFileRequested = $this->uri->segment(3); $splitAroundPipe = explode('-', $imageFileRequested); $scripNum = $splitAroundPipe[0]; $scripNum = 32; $splitOnFullstop = explode('.', $splitAroundPipe[1]); $pageNum = $splitOnFullstop[0]; $script->retrieve($scripNum); $pageFile = $script->pages->getPageKeyAt((int) $pageNum); $this->_outputPage($pageFile); }
public function __construct() { $this->actionListener(); $this->output = Utils::obfuscateMailTo($this->view->show(), Script::getInstance()); // TODO prepend msg thrown by Logger Logger::getInstance()->writeLog(); }
/** * returns the instance created by its first invoke. * * @return Script */ public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; }
function onActive($arguments) { if (!empty($arguments['divider'])) $this->divider = $arguments['divider']; parent::onActive($arguments); }
function onActive($arguments) { foreach ($arguments as $key => $value) { $this->zones[$key] = $value['template']; if (is_array($value['events'])) { foreach ($value['events'] as $event) { if (!is_array($this->events[$event])) $this->events[$event] = array($key); else $this->events[$event][] = $key; } } else { if (!is_array($this->events[$value['events']])) $this->events[$value['events']] = array($key); else $this->events[$value['events']][] = $key; } } parent::onActive($arguments); }
public function show() { // sitemap $sitemap = $this->controller->sitemap(); // legal notice $left = array_key_exists('legal_notice', $this->config) ? $this->config['legal_notice'] : ''; $left = '<div class="col-md-8"><p>' . $left . '</p></div>'; $right = '<div class="col-md-4"><p class="pull-right"><a href="#" class="page-scroll">Back to top</a></p></div>'; // social $social = ''; $general = Config::getInstance()->getGeneralArray('general'); if (array_key_exists('social', $general) && $general['social']) { $buttons = Social::getInstance()->socialButtons('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], Head::getInstance()->getTitle()); $span = floor(6 / count($buttons)); $xs = floor(12 / count($buttons)); foreach ($buttons as $b) { $social .= '<div class="col-xs-' . $xs . ' col-md-' . $span . ' text-center">' . $b . '</div>'; } $x = floor((8 - count($buttons)) / 2); $social = '<div class="row"><div class="col-md-offset-2 col-md-' . $x . '"></div>' . $social . '</div>'; } // powered by $poweredby = ''; if (isset($this->config['poweredby'])) { $poweredby = '<p class="poweredby text-center">' . $this->config['poweredby'] . '</p>'; $poweredby = '<div class="row"><div class="col-md-8 col-md-offset-2">' . $poweredby . '</div></div>'; } // put it together $sitemap = $sitemap . '<div class="footer-inner row">' . $left . $right . '</div>' . $social . $poweredby; return Utils::obfuscateMailTo($sitemap, Script::getInstance()); }
protected function _tag($code) { if ($this->tag === true) { return Script::open(true, $this->jqueryCdn, $this->jqueryUiCdn) . $code . Script::close(); } return $code; }
function index() { $data = array(); $data['nbMembre'] = $this->membre->findFirst(array('champs' => 'DISTINCT COUNT(mem_id) as nbMembre', 'tables' => 'membre', 'conditions' => 'mem_etat = 1', 'fecthMethod' => PDO::FETCH_ASSOC)); $data['nbReseau'] = $this->reseau->findFirst(array('champs' => 'DISTINCT COUNT(net_id) as nbReseau', 'tables' => 'reseau', 'fecthMethod' => PDO::FETCH_ASSOC)); $data['nbGroupe'] = $this->groupe->findFirst(array('champs' => 'DISTINCT COUNT(gr_id) as nbGroupe', 'tables' => 'groupe', 'fecthMethod' => PDO::FETCH_ASSOC)); $data['nbDocs'] = $this->groupe->findFirst(array('champs' => 'DISTINCT COUNT(doc_id) as nbDocs', 'tables' => 'document', 'fecthMethod' => PDO::FETCH_ASSOC)); $data['nbHits'] = $this->groupe->findFirst(array('champs' => 'DISTINCT SUM(hits) as nbHits', 'tables' => 'openu_files', 'fecthMethod' => PDO::FETCH_ASSOC)); //derniers fichiers ajoutés $data['fichiers'] = $this->document->find(array('tables' => 'openu_files', 'champs' => '*', 'limit' => '0,5', 'order' => 'upload_date DESC', 'fecthMethod' => PDO::FETCH_ASSOC)); //matières les plus demandées $matieres = $this->document->find(array('tables' => 'reseau_membre', 'champs' => 'DISTINCT net_id', 'fecthMethod' => PDO::FETCH_ASSOC)); if (!empty($matieres)) { $data['nbInscrits'] = 0; $i = 0; foreach ($matieres as $value) { $tmp = $this->document->findFirst(array('tables' => 'reseau_membre', 'champs' => 'COUNT(mem_id) as nbInscrits', 'conditions' => 'net_id = ' . $value['net_id'], 'fecthMethod' => PDO::FETCH_ASSOC)); $matieres[$i]['nbInscrits'] = (int) $tmp['nbInscrits']; $i++; } //tri des matières $matieresPlusDemandees = array(); $max1 = 0; $max2 = 0; for ($k = 0; $k < count($matieres); $k++) { for ($j = 0; $j < count($matieres); $j++) { if ($matieres[$j]['nbInscrits'] >= $max1) { $matieresPlusDemandees[0] = $matieres[$j]; $max1 = $matieres[$j]['nbInscrits']; } elseif ($matieres[$j]['nbInscrits'] > $max2) { $matieresPlusDemandees[1] = $matieres[$j]; $max2 = $matieres[$j]['nbInscrits']; } } } $data['matieres'] = $this->document->find(array('tables' => 'reseau', 'champs' => '*', 'conditions' => 'net_id = ' . $matieresPlusDemandees[0]['net_id'] . ' OR net_id =' . $matieresPlusDemandees[1]['net_id'], 'fecthMethod' => PDO::FETCH_ASSOC)); } $list = Script::_multi_script(array(array('action' => 'keyup', 'element' => '#searchBar', 'name' => '', 'code' => " var valeur=\$('#searchBar').val(); if(valeur.length>4) searchFiles(valeur); "))); /*Les champs obligatoires pour le type _query : toReload, "query, #element, #reponse , "method, "url*/ $data['mesScripts'] = $list['s']; //définitions des fonctions => dans le header $data['mesScriptsFunc'] = $list['d']; // appels des fonctions définis => dans le footer $this->myrender(array('menu' => 'menu', 'title' => constant('site_i_name'), 'view' => 'index', 'variables' => $data)); }
/** * This function loads all images contained in the folder stored in $this->path, * generate the bootstrap modal carousel and returns it. * * @param int $index * @return string generated carousel */ public function parse($index) { $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index); try { Head::getInstance()->link('lib/owl-carousel/css/owl.carousel.css'); Head::getInstance()->link('lib/owl-carousel/css/owl.theme.css'); Script::getInstance()->link('lib/owl-carousel/js/owl.carousel.js'); Head::getInstance()->link('lib/owl-carousel/css/lazy_load.css'); Script::getInstance()->link('lib/owl-carousel/js/lazy_load.js'); $items = ''; foreach ($files as $f) { $items .= '<div class="item"><img class="lazyOwl" data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '" /></div>'; } return '<div id="carousel" class="owl-carousel owl-theme">' . $items . '</div>'; } catch (Exception $e) { Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'OwlCarousel::parse("' . $this->config['path'] . '")', $e->getMessage())); return ''; } }
public function show($id = null) { if (isset($_GET['id'])) { $id = $_GET['id']; } $script = Script::find_by_id($id); if (!$script) { Error404(); } $page = 1; if (isset($_GET['page'])) { $page = $_GET['page']; } $id = mysql_real_escape_string($script->id); $paginate = ScriptLog::paginate("scripts.id = '{$id}'", "scriptlogs.created_at DESC, scriptlogs.id DESC", $page, 50); $this->assign("page", $paginate); $this->assign("script", $script); $this->title = "Scheduled Scripts :: {$script->name} :: Logs"; $this->render("scriptlog/show.tpl"); }
/** * This function loads all images contained in the folder stored in $this->path, * generate the bootstrap modal carousel and returns it. * * @param int $index * @return string generated carousel */ public function parse($index) { $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index); try { Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.css'); Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/default-skin/default-skin.css'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.min.js'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe-ui-default.min.js'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/init.js'); $html = file_get_contents(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.html'); $items = ''; foreach ($files as $f) { list($width, $height) = getimagesize($this->config['path'] . $f); $src = 'data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '"'; $width = 'data-width="' . $width . '"'; $height = 'data-height="' . $height . '"'; $items .= '<span ' . $src . $width . $height . '" class="img-swipe">'; } return '<div class="hidden">' . $items . '</div>' . $html; } catch (Exception $e) { Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'PhotoSwipe::parse("' . $this->config['path'] . '")', $e->getMessage())); return ''; } }
public function is_at_least($value, $min, $msg_eligible, $msg_not) { return $this->condition($value != null && $value >= $min, $msg_eligible, $msg_not); } public function is_at_most($value, $max, $msg_eligible, $msg_not) { return $this->condition($value != null && $value <= $max, $msg_eligible, $msg_not); } } ############################ ## Initialize ############################ $event = $backend->get('event') ?: $backend->getRouteValue() ?: Script::DEFAULT_EVENT; $user = $backend->get('user') ?: $backend->getRouteValue(2) ?: ''; $wiki = $backend->get('wiki', NULL); $script = new Script($backend, $user, $event, $wiki); ############################ ## Input form ############################ echo ' <form action="', $backend->url('/accounteligibility'), '" method="get"> <label for="user">User:</label> <input type="text" name="user" id="user" value="', $backend->formatValue($script->user['name']), '" /> at <select name="wiki" id="wiki"> <option value="">auto-select wiki</option>', "\n"; foreach ($script->wikis as $dbname => $details) { if (!$script->db->getLocked($dbname)) { $selected = $dbname == $wiki; echo '<option value="', $dbname, '"', $selected ? ' selected="yes" ' : '', '>', $script->formatText($details['domain']), '</option>'; } }
<?php require "init.php"; $script = Script::find_by_code('delete_sessions'); $script->start(); ob_start(); $time = date("H:i:s"); echo "[{$time}] Deleting old RPC sessions\r\n\r\n"; RPCSession::clear(); $script = Script::find_by_code('delete_sessions'); $output = ob_get_clean(); $script->finish($output);
public function scripts_list() { $args = func_get_args(); // func_get_args(): Can't be used as a function parameter before PHP 5.3.0 $res = $this->__call('scripts_list', $args); if ($res === null) { return null; } $scripts = array(); foreach ($res as $item) { $s = new Script($item); if (!$s->is_valid()) { continue; } $scripts[] = $s; } return $scripts; }
public function renderScriptAssets($collection = null) { $output = ''; if ($collection) { $collection = $this->getCollection($collection); } else { $collection = $this->collections[$this->selectedCollection]; } if ($collection) { $assets = $collection->getAssets(); foreach ($assets['script'] as $asset) { if ($asset->isRemote()) { $output .= $asset->render() . "\n"; } else { if (!$this->cdnBaseUrl) { $output .= $asset->render() . "\n"; } } } if ($this->cdnBaseUrl) { $assetPath = "{$this->cdnBaseUrl}/" . $collection->getName(); $assetPath .= '.js'; $style = new Script($assetPath); $output .= $style->render() . "\n"; } foreach ($assets['embeddedScript'] as $asset) { $output .= $asset->render() . "\n"; } } $runtimeAssets = $this->runtimeCollection->getAssets(); foreach ($runtimeAssets['script'] as $asset) { $output .= $asset->render() . "\n"; } foreach ($runtimeAssets['embeddedScript'] as $asset) { $output .= $asset->render() . "\n"; } return $output; }
<?php if ($_POST) { $item = $_POST['item']; $data = $_POST['data']; $qtd = $_POST['qtd']; include 'class/script.class.php'; $script = new Script(); $media = $script->getMediaItem($item); $qtd2 = $script->getQtdList($data, $item); // echo $qtd2.'|'.$media['med']; // Primeiro verifica a média de itens comparando com os itens que tem na lista $response = array(); if ($media['med'] > 0) { if ($qtd2 >= $media['med']) { $response = array('retorno' => false, 'tipo' => 'lista', 'qtd' => $qtd2, 'med' => $media['med'], 'recomendado' => $script->randomItem($data)); } else { if ($qtd2 + $qtd >= $media['med']) { $response = array('retorno' => false, 'tipo' => 'item', 'qtd' => $qtd2, 'med' => $media['med']); } else { $response = array('retorno' => true); } } } else { $response = array('retorno' => true); } echo json_encode($response); }
/** * Test * * @return void */ public function testInit() { $this->assertNull($this->object->init()); }
new Menu('relatorio'); ?> <div class="ui container"> <div class="ui icon attached message"> <i class="file text outline icon"></i> <div class="content"> <div class="header"> Relatório </div> <p>Relatório sobre as listas e os produtos</p> </div> </div> <?php $script = new Script(); $tipo = new Tipo(); $item = new Item(); ?> <div class="ui message"> <?php if ($_GET) { $listOrd = array(); $listKey = null; // Agrupa os itens iguais somando a quantidade foreach ($script->getList() as $key => $list) { if ($list['Data'] == $_GET['list']) { $listKey = $key; foreach ($list['lista'] as $key => $registro) { $indice = array_search($registro['Item'], array_column($listOrd, 'item'));
<?php require "init.php"; $script = Script::find_by_code("unpaid_emails"); $script->start(); ob_start(); $time = date("H:i:s"); echo "[{$time}] Forums\r\n\r\n"; $offset = 31; $lower = strtotime("-{$offset} days midnight"); $offset--; $upper = strtotime("-{$offset} days midnight"); $signups = EventSignup::find_all("\n\t\tevent_signups.paid = false\n\t\tAND event_signups.voucher = false\n\t\tAND event_signups.created_at BETWEEN FROM_UNIXTIME({$lower}) AND FROM_UNIXTIME({$upper})\n\t\tAND events.startdate > NOW()\n\t\tAND users.allow_emails = true\n\t\tAND users.suspended = false\n\t\tAND users.activated = true\n\t"); $users = array(); foreach ($signups as $signup) { if (!in_array($signup->user->id, $users)) { if ($signup->event_ticket->participant && $signup->event->count_participants("paid") < $signup->event->capacity) { $users[] = $signup->user->id; $script->addlog("Reminder sent to {$signup->user->email} ({$signup->user->nickname}) for [{$signup->id}]"); echo "Sending reminder to {$signup->user->email} ({$signup->user->nickname}) for signup {$signup->id}\n"; Email::send_signup_reminder($signup); } } } $script = Script::find_by_code("unpaid_emails"); $output = ob_get_contents(); $script->finish($output);
/* * Page where output of an executed script is show */ include_once dirname(__FILE__) . "/classes/Script.php"; include_once dirname(__FILE__) . "/classes/User.php"; session_start(); if (!isset($_SESSION['USERNAME'])) { redirect("login.php", 302); exit; } else { //TODO Session duration check try { $user = new User($_SESSION['USERNAME']); $id = $_GET['SCRIPTID']; $s = new Script($id); $out = $s->Exec($user); } catch (Exception $e) { $error = $e->getMessage(); } } ?> <html> <head> <title>RaspiControl</title> <meta charset="utf-8"/> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"/> <meta name="msapplication-tap-highlight" content="no"/> <meta name="apple-mobile-web-app-capable" content="no">
/** * {@inherit} * * {@inherit} */ public function call(array $options = []) { // Merge the options from config with passed options $options = array_merge($this->callbackOptions, $options); parent::call($options); }
public function post_load_all_scripts() { $results = array(); $results = Script::loadAllScripts(); $this->response(array('status' => 'SUCCESS', 'results' => $results)); }
$page = UserAchievement::paginate("user_achievements.processed = 0", "user_achievements.created_at ASC", 1, 50); $count = count($page->collection); echo " Processing {$count} / {$page->total} achievements\r\n"; foreach ($page->collection as $obj) { mysql_query('BEGIN'); $loyalty = true; if ($obj->achievement->points_value > 0) { $loyalty = $obj->user->award_loyalty($obj->achievement->points_value, "Achievement: {$obj->achievement->name}"); $script->addlog("Awarded {$obj->achievement->points_value}pts to [{$obj->user}] {$obj->user->nickname} for [{$obj->achievement}] {$obj->achievement->name}"); } $obj->processed = true; $ua = $obj->save(); if ($loyalty && $ua) { mysql_query('COMMIT'); } else { echo "Error processing [{$obj}]\r\n"; print_r($obj); mysql_query('ROLLBACK'); $script->addlog("Error processing [{$obj}]", 'Critical'); print_r($obj->errors); print_r($obj->errors[0]); if (count($obj->errors) > 0 && $obj->errors[0] == 'User has already been awarded that achievement') { $obj->processed = true; $obj->save(); $script->addlog("[{$obj}] was already processed. Marking it as processed", 'Warning'); } } } $script = Script::find_by_code('loyalty_achievements'); $output = ob_get_clean(); $script->finish($output);
function load($age, $eix, $ue, $dir = null, $paramtoken = null) { if (!$this->session->islogged()) { $this->redirect("?membre/login"); } if (!isset($paramtoken)) { $message = "Vous tentez d'accéder à un répertoire inexistant."; $this->error($message); exit; } $dir = urldecode(str_replace('~', '/', $dir)); $path = $age == 'a' ? 'filesOld' : 'files'; //a ancien $path .= strtolower(DS . 'ei' . $eix . DS . $ue . DS . (!empty($dir) ? $dir != 'dir' ? $dir . DS : '' : '')); //$file = BASE_URL.DS.$path.Session::getReverseToken($paramtoken); if ($age == 'a') { $token = Session::getReverseToken($paramtoken); $filename = $token; } elseif ($age == 'n') { $get = $this->document->findFirst(array('conditions' => " doc_code = " . Functions::squote($paramtoken))); $path = $get->doc_path; $filename = $get->doc_name; } $file = '..' . DS . $path . $filename; if (file_exists($file)) { $size = filesize($file); $erreurs = $this->force_telechargement(array('filename' => $filename, 'type' => 'application/octet-stream', 'size' => $size, 'dir' => $path, 'complete_name' => $file)); if ($erreurs[0] && $age == 'a') { Session::delToken($token); Session::addToken($token); $tmpFile = $this->document->findFirst(array('tables' => " openu_oldfiles ", 'conditions' => " path LIKE '%" . $file . "%'", 'fecthMethod' => PDO::FETCH_ASSOC)); // enregistrement du nombre de téléchargement if (!empty($tmpFile)) { $this->document->upDate(array('tables' => " openu_oldfiles ", 'affectations' => "hits = hits+1", 'conditions' => " path LIKE '%" . $file . "%'", 'fecthMethod' => PDO::FETCH_ASSOC)); } /** Enregistrement de l'activité sur les OldFiles */ //l'activité est créée automatiquement à la connexion $this->document->upDate(array('tables' => 'activite_membre', 'affectations' => "nb_down = nb_down+1", 'conditions' => ' id_user = '******'membre']['mem_id'])); } else { $this->error($erreurs[1]); return false; } } $list = Script::_multi_script(array(array('action' => 'ready', 'element' => 'body', 'name' => 'body', 'code' => "setTimeout('self.close()',10000);"))); /*Les champs obligatoires pour le type _query : toReload, "query, #element, #reponse , "method, "url*/ $variables['mesScripts'] = $list['s']; //définitions des fonctions => dans le header $variables['mesScriptsFunc'] = $list['d']; $variables['file'] = $file; $this->myrender(array('menu' => 'menu', 'title' => 'Telechargement de la ressource en cours', 'view' => 'load', 'variables' => $variables)); }
if (count($v)) { $conditions[] = '`' . $field . '` IN(' . implode(',', $v) . ')'; } } } /* build query */ $sql = 'SELECT * FROM `codes`'; if (count($conditions)) { $sql .= ' WHERE ' . implode(' AND ', $conditions); } $sql .= ' ORDER BY `list`, `code` LIMIT ' . Script::MAX_LIMIT . ' OFFSET ' . $this->offset; $this->query = $sql; $this->values = $values; } } $script = new Script(); #################### ## Output form #################### //input form function filterOption($key, $text = NULL) { global $script, $backend; if (!$text) { $text = $key; } $checked = in_array($key, $script->filters); echo '<option value="', $backend->formatValue($key), '"', $checked ? ' selected="selected"' : '', '">', $backend->formatText($text), '</option>'; } ?>
function profil($param) { if (!$this->session->islogged()) { $this->redirect("?membre/login/"); } //changement de layout pour les tests $this->layout = 'default'; //récupération des infos de sessions $variables['user'] = $_SESSION['membre']; //récupération des données $variables['reseaux'] = $this->reseau->find(array('tables' => ' reseau r NATURAL JOIN reseau_membre rm ', 'conditions' => "rm.mem_id = " . $_SESSION['membre']['mem_id'], 'fecthMethod' => PDO::FETCH_ASSOC)); $variables['groupes'] = $this->groupe->find(array('tables' => ' groupe g NATURAL JOIN groupe_membre gm ', 'conditions' => "gm.mem_id = " . $_SESSION['membre']['mem_id'], 'fecthMethod' => PDO::FETCH_ASSOC)); $id = $_SESSION['membre']['mem_id']; $variables['contacts'] = $this->membre->find(array('tables' => ' membre NATURAL JOIN (SELECT * FROM contact_membre WHERE ( mem_id_1 = ' . $id . ' OR mem_id_2 = ' . $id . ') ) as c', 'champs' => 'mem_id, mem_login', 'conditions' => "cm_valid = 1 AND (mem_id=c.mem_id_1 OR mem_id=c.mem_id_2) AND mem_id != " . $id, 'fecthMethod' => PDO::FETCH_ASSOC)); $variables['lastComers'] = $this->membre->find(array('order' => 'mem_date_joined DESC ', 'limit' => '5', 'fecthMethod' => PDO::FETCH_ASSOC)); $variables['activite'] = $this->membre->findFirst(array('tables' => 'activite_membre', 'conditions' => ' id_user = '******'membre']['mem_id'], 'fecthMethod' => PDO::FETCH_ASSOC)); //création des scripts $list = Script::_multi_script(array(array('type' => '_script', 'action' => 'click', 'element' => '#btn_change_year', 'name' => 'btn_change_year', 'code' => " var year = \$('#input_change_year').val(); \$.ajax({ type : 'GET', url : '?ajax/profil/', data : 'year:'+year,success : function(server_response){ \$('#result_change_year').html(server_response).fadeIn(2000);} });\n "), array('type' => '_script', 'action' => 'click', 'element' => '#btn_change_ue', 'name' => 'btn_change_ue', 'code' => " var ue = \$('#input_change_ue').val(); \$.ajax({ type : 'GET', url : '?ajax/profil/', data : 'ue:'+ue,success : function(server_response){ \$('#result_change_ue').html(server_response).fadeIn(2000);} });\n "), array('type' => '_script', 'action' => 'click', 'element' => '#btn_change_temperament', 'name' => 'btn_change_temperament', 'code' => " var temperament = \$('#input_change_temperament').val(); \$.ajax({type : 'GET', url : '?ajax/profil/', data : 'temperament:'+temperament, success : function(server_response){ \$('#result_change_temperament').html(server_response).fadeIn(2000);} });\n "))); /*Les champs obligatoires pour le type _query : toReload, "query, #element, #reponse , "method, "url*/ $variables['mesScripts'] = $list['s']; //définitions des fonctions => dans le header $variables['mesScriptsFunc'] = $list['d']; // appels des fonctions définis => dans le footer $this->myrender(array('menu' => 'menu', 'title' => 'Accueil', 'view' => 'profil', 'variables' => $variables)); }
<?php require "init.php"; $script = Script::find_by_code('twitter'); $script->start(); ob_start(); $time = date("H:i:s"); echo "[{$time}] Processing Twitter Queue\r\n\r\n"; Tweet::process($script); $script = Script::find_by_code('twitter'); $output = ob_get_clean(); $script->finish($output);