本文整理汇总了PHP中SC类的典型用法代码示例。如果您正苦于以下问题:PHP SC类的具体用法?PHP SC怎么用?PHP SC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param Base $Base
* @param string $table
*/
public function __construct(SC $Base, $table)
{
$this->Base = $Base;
$this->table = $table;
$this->escapeChar = $Base->getEscapeQuote();
$this->fkEnding = $Base->getFkEnding();
$this->tableClause = "{$this->escapeChar}{$table}{$this->escapeChar}";
$this->whereClause = '1';
}
示例2: success
public function success()
{
$this->view->title = 'Налаштування';
$this->view->alert = 'Налаштування успішно збережено';
$this->view->data = $this->model->getUserInfo(SC::getSession('id'));
$this->view->render('userSettings/index');
}
示例3: checkPrivileges
public function checkPrivileges($o)
{
$username=SC::get('userdata.username');
if(in_array($username,array('dev1','dev2'))){
return true;
}
$uid=SC::get('userdata.user_id');
$dao=DaoFactory::create('user/admin');
$dao->select('count(user_id) as count');
$dao->byUserId($uid);
$rs=$dao->execute();
if(!$rs->isSuccess())
{
throw new CircuitDatabaseException('query admin users failed', $rs);
}
$count=$rs->fetchrow(DB_ASSOC);
if($count['count']==0)
{
$message = "This page is not available under the current configuration, or ";
$message .= "you are not authorized to view this page.";
$o->set('error.message', $message);
$o->set('error.code', GENERAL_MESSAGE);
$o->set('error.title', 'Not Authorized');
$o->set('error.line', __LINE__);
$o->set('error.file', __FILE__);
return false;
}
return true;
}
示例4: getAllUsers
public function getAllUsers()
{
$user_id = SC::getCookie('id');
$u = $this->db->select('tests', 'id,name,date', 'user_id=' . $user_id . '');
if ($this->db->getCount() != 0) {
$users = '<div class="table-responsive">';
$users .= '<table class="table table-condensed table-bordered table-hover">';
$users .= '<thead><tr class="caption">';
$caption = array('#', 'Назва тесту', 'Дата створення');
$cook = SC::getCookie('id');
foreach ($caption as $k => $v) {
$users .= '<th style="text-align: center,width:200px; ">' . $v . '</th>';
}
$users .= '</tr></thead>';
for ($i = 0; $i < sizeof($u); $i++) {
// if ( $u[$i]['id'] != SC::getCookie ( 'id' ) ) {
$users .= '<tr>';
foreach ($u[$i] as $k => $v) {
//if ( $k != 'password' && $k != 'date' && $k != 'activateCode' && $k != 'hash' ) {
$users .= '<td><a href="' . URL . '?c=testsResult&f=showOne&p=' . $u[$i]['id'] . '">' . $v . '</a></td>';
//}
}
$users .= '</tr>';
//}
}
$users .= '</table>';
$users .= '</div>';
}
return $users;
}
示例5: checkUserData
public function checkUserData($login, $password)
{
$user = $this->db->select('users', 'id, password, group, date, activate', "`login`='{$login}'");
if ($this->db->getCount() == 1) {
$user = $user[0];
} else {
return 0;
}
/*
* Якщо користувач не активований, то повідомляємо про це
*/
if ($user['activate'] == 0) {
return 2;
}
if (Hash::checkHash($password, $user['password'])) {
$randHash = Hash::getRandomHash();
SC::setCookie('id', $user['id']);
SC::setSession('id', $user['id']);
SC::setCookie('login', $login);
SC::setSession('login', $login);
SC::setCookie('group', $user['group']);
SC::setSession('group', $user['group']);
SC::setCookie('userHash', $randHash);
SC::setSession('userHash', $randHash);
$this->db->update('users', array('hash' => $randHash), "`id`='{$user['id']}'");
$this->getCountBYDay();
return 1;
} else {
return 0;
}
}
示例6: getAllUsers
public function getAllUsers()
{
$u = $this->db->select_order('pages', 'id,title,url', 'id', 'DESC');
if ($this->db->getCount() != 0) {
$users = '<div class="table-responsive">';
$users .= '<table class="table table-condensed table-bordered table-hover">';
$users .= '<thead><tr class="caption">';
$caption = array('#', 'Заголовок', 'URL', 'Дії');
$cook = SC::getCookie('id');
foreach ($caption as $k => $v) {
$users .= '<th style="text-align: center,width:200px; ">' . $v . '</th>';
}
$users .= '</tr></thead>';
for ($i = 0; $i < sizeof($u); $i++) {
// if ( $u[$i]['id'] != SC::getCookie ( 'id' ) ) {
$users .= '<tr>';
foreach ($u[$i] as $k => $v) {
//if ( $k != 'password' && $k != 'date' && $k != 'activateCode' && $k != 'hash' ) {
$users .= '<td>' . $v . '</td>';
//}
}
$users .= '<td>';
$users .= '<a class="users-info-links" href="?c=managePages&f=edit&p=' . $u[$i]['id'] . '">Редагувати</a><br />';
$users .= '<a class="users-info-links" href="?c=managePages&f=delete&p=' . $u[$i]['id'] . '">Видалити</a>';
$users .= '</td>';
$users .= '</tr>';
//}
}
$users .= '</table>';
$users .= '</div>';
}
return $users;
}
示例7: getAllInfo
public function getAllInfo()
{
$u = $this->db->select_order('guestbook', '*', 'id', 'DESC');
if ($this->db->getCount() != 0) {
$data = '<div class="table-responsive">';
$data .= '<table class="table table-condensed table-bordered table-hover">';
$data .= '<thead><tr class="caption">';
$caption = array('#', 'Автор', 'Email', 'Текст', 'Дата', 'Відповісти');
$cook = SC::getCookie('id');
foreach ($caption as $k => $v) {
$data .= '<th style="text-align: center,width:200px; ">' . $v . '</th>';
}
$data .= '</tr></thead>';
for ($i = 0; $i < sizeof($u); $i++) {
$data .= '<tr>';
foreach ($u[$i] as $k => $v) {
$data .= '<td>' . $v . '</td>';
}
$data .= '<td>';
$data .= '<a class="users-info-links" href="?c=manageGuestBook&f=answer&p=' . $u[$i]['id'] . '&email=' . $u[$i]['email'] . '"> Відповісти</a>';
$data .= '</td>';
$data .= '</tr>';
}
$data .= '</table>';
$data .= '</div>';
}
return $data;
}
示例8: getAllImagesById
public function getAllImagesById($id)
{
$u = $this->db->select('images', 'id,title,img', "gallery_id='{$id}' ORDER BY id DESC");
if ($this->db->getCount() != 0) {
$data = '<div class="table-responsive">';
$data .= '<table class="table table-condensed table-bordered table-hover">';
$data .= '<thead><tr class="caption">';
$caption = array('#', 'Назва', 'Титульне зображення', 'Дії');
foreach ($caption as $k => $v) {
$data .= '<th style="text-align: center">' . $v . '</th>';
}
$data .= '</tr></thead>';
for ($i = 0; $i < sizeof($u); $i++) {
if ($u[$i]['id'] != SC::getCookie('id')) {
$data .= '<tr>';
foreach ($u[$i] as $k => $v) {
if ($k == "img") {
$data .= '<td><img src="public/gal_img/' . $v . '" width="230px" height="180px"></td>';
} else {
$data .= '<td>' . $v . '</td>';
}
}
$data .= '<td>';
$data .= '<a class="users-info-links" href="?c=manageImages&f=edit&p=' . $u[$i]['id'] . '">Редагувати</a><br />';
$data .= '<a class="users-info-links" href="?c=manageImages&f=delete&p=' . $u[$i]['id'] . '">Видалити</a>';
$data .= '</td>';
$data .= '</tr>';
}
}
$data .= '</table>';
$data .= '</div>';
}
return $data;
}
示例9: getTeachers
public function getTeachers()
{
$u = $this->db->select('rozklad_teachers', '*');
if ($this->db->getCount() != 0) {
$users = '<div class="table-responsive">';
$users .= '<table class="table table-condensed table-bordered table-hover">';
$users .= '<thead><tr class="caption">';
$caption = array('#', 'Прізвище', 'Ім\'я', 'По-батькові', 'Дії');
$cook = SC::getCookie('id');
foreach ($caption as $k => $v) {
$users .= '<th style="text-align: center,width:200px; ">' . $v . '</th>';
}
$users .= '</tr></thead>';
for ($i = 0; $i < sizeof($u); $i++) {
$users .= '<tr>';
foreach ($u[$i] as $k => $v) {
$users .= '<td>' . $v . '</td>';
}
$users .= '<td>';
$users .= '<a class="users-info-links" href="?c=manageRozkladsTeachers&f=edit&p=' . $u[$i]['id'] . '">Редагувати</a><br />';
$users .= '<a class="users-info-links" href="?c=manageRozkladsTeachers&f=delete&p=' . $u[$i]['id'] . '">Видалити</a>';
$users .= '</td>';
$users .= '</tr>';
}
$users .= '</table>';
$users .= '</div>';
}
return $users;
}
示例10: execute
/**
* Execute
*/
function execute(&$observer)
{
// MOD RJH
// Modification Date: 11-18-2004
// Add Tracking for all actions into a single consolidated Admin Log Table
// using Sushi to store data
// TRACKING
// ID (pk), USER ID(ind), IP(ind), datetime, request page, POST/GET
if( preg_match("/^10./",$_SERVER['REMOTE_ADDR']) ) return TRUE;
$GAIALOG = serialize(array($_GET,$_POST));
$dao_logging =& DaoFactory::create('admincpanellog.insert');
$dao_logging->setUserId(SC::get('userdata.user_id'));
$dao_logging->setUsername(SC::get('userdata.username'));
$dao_logging->setUserIp($_SERVER['REMOTE_ADDR']);
$dao_logging->setDatetime(SC::get('board_config.time_now'));
$dao_logging->setRequestFilename($_SERVER['SCRIPT_NAME']);
$dao_logging->setRequestData($GAIALOG);
$rs =& $dao_logging->execute();
if(!$rs->isSuccess())
{
$observer->set('error.message', "Unable to connect to the database, please try again later.");
$observer->set('error.title', 'Database Error');
$observer->set('error.code', GENERAL_ERROR);
$observer->set('error.line', __LINE__);
$observer->set('error.file', __FILE__);
return FALSE;
}
return TRUE;
}
示例11: delete
public function delete()
{
$api = new SCApi();
$arr = $api->usersessions_delete(true);
if ($arr["loggedout"]) {
SC::transfer();
}
}
示例12: jsonify
public function jsonify($callback = null)
{
$fields = array("from", "author", "subject", "body", "to", "bcc", "header");
$props = array();
foreach ($fields as $id => $field) {
$props[$field] = $this->{$field};
}
return SC::jsonify($props, $callback);
}
示例13: create
public function create()
{
try {
$api = new SCApi();
$user = $api->users_create();
SC::checkRedir(SCRoutes::set("users", "memberships_index", array("userid" => $user->userid)));
} catch (Exception $ex) {
SC::setFlashMessage($ex->getMessage(), "error");
$this->_new();
}
}
示例14: execute
function execute(&$observer)
{
if (SC::isEmpty('userdata.user_id') || !require_level(USERLEVEL_ADMINISTRATION_TEAM)) {
$observer->set('error.title', 'Permissions Error');
$observer->set('error.message', 'You do not have permission to access this function.');
$observer->set('error.line', __LINE__);
$observer->set('error.file', __FILE__);
return FALSE;
}
return TRUE;
}
示例15: getNumNewDoc
public function getNumNewDoc()
{
if (SC::getSession('group') == 'lector') {
$current_date = date('Y-m-d');
$e = $this->db->select('lab_documents', '*', ' date > ' . $current_date . '');
$e = $this->db->getCount();
} else {
$e = null;
}
return $e;
}