public function shopId() { $session = new Session(); $session->open(); $shop = AdminUser::find($session['pk'])->one(); return $shop->shopid; }
public static function start() { if (!Session::$_started) { if (defined('SESSION_NAME')) { Session::$sessionName = SESSION_NAME; } else { Session::$_sessionName = 'ZARAFA_REST_API_SESSION'; } session_name(Session::$_sessionName); Session::open(); session_regenerate_id(); Session::$_started = true; } else { Session::open(); } }
/** * @inheritdoc */ public function getId() { $session = new Session(); $session->open(); $pk = $this->getPrimaryKey(); $session['pk'] = $pk; return $pk; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with TsunAMP; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * * PlayerUI Copyright (C) 2013 Andrea Coiutti & Simone De Gregori * Tsunamp Team * http://www.tsunamp.com * * Rewrite by Tim Curtis and Andreas Goetz */ require_once dirname(__FILE__) . '/inc/connection.php'; require_once dirname(__FILE__) . '/inc/worker.php'; Session::open(); $workerSuccess = false; // Handle reset if (isset($_POST['reset']) && $_POST['reset'] == 1) { $mpdconfdefault = ConfigDB::read('', 'mpdconfdefault'); foreach ($mpdconfdefault as $element) { ConfigDB::update('cfg_mpd', $element['param'], $element['value_default']); } // Tell worker to write new MPD config if ($workerSuccess = workerPushTask('mpdcfg')) { uiSetNotification('MPD config reset', 'Restarting MPD server...'); } } // Handle restart (same as process for mpdcfg) if (isset($_POST['mpdrestart']) && $_POST['mpdrestart'] == 1) { // Tell worker to write new MPD config
/** * Wait for worker to finish task */ function waitWorker($sleeptime = 1) { if ($_SESSION['w_active'] == 1) { logWorker('[client] waiting for worker'); $wait = 0; do { sleep($sleeptime); if (++$wait % 5 === 0) { logWorker(sprintf('[client] waitWorker (%d)', $wait)); } Session::open(); Session::close(); } while ($_SESSION['w_active'] == 1); logWorker('[client] worker finished'); } }
/** * Open a new session, this is a simple method which doesnt return anything, it should simply not throw any errors */ public function testSessionOpen() { Session::open(); }