本文整理汇总了PHP中sConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP sConfig函数的具体用法?PHP sConfig怎么用?PHP sConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: throwErrorPage
function throwErrorPage($code)
{
if ($code == "404") {
$header = $_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found';
} else {
if ($code == "403") {
$header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden';
} else {
$header = $_SERVER['SERVER_PROTOCOL'] . ' ' . $code;
}
}
header($header);
$errorPage = sConfig()->getVar('CONFIG/ERRORPAGES/ERROR_' . $code);
if ($errorPage && $errorPage != '') {
$request_path_string = getRequestPathString(explode('/', 'page' . $errorPage));
$request_path = getRequestPathArray($request_path_string);
$psite = $request_path[1];
if ((int) $psite > 0) {
$sinfo = sSites()->get($psite);
$siteID = (int) $psite;
} else {
$sinfo = sSites()->getByPName($psite);
$siteID = $sinfo['ID'];
}
$pageMgr = new PageMgr($siteID);
$pageID = $pageMgr->getPageIdByPname($request_path[count($request_path) - 1]);
$page = $pageMgr->getPage($pageID);
$pageInfo = $page->get();
$version = $page->getLatestVersion();
renderPage($page, $version, $pageInfo, $pageMgr, $sinfo);
} else {
echo $header;
}
die;
}
示例2: process
public function process($objectid, $params)
{
$view = $params["VIEW"];
$fileMgr = sFileMgr();
$view = $fileMgr->views->get($view["ID"]);
$fileinfo = $params["FILEINFO"];
$filedir = getrealpath(getcwd() . "/" . sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR')) . "/";
$filename = $fileinfo['OBJECTID'] . '-' . $fileinfo['VIEWVERSION'] . $fileinfo['FILENAME'];
$file = $filedir . $filename;
$imgsize = getimagesize($file);
$info = $this->generateThumbnail($filename, $imgsize, $view['IDENTIFIER'], $view['WIDTH'], $view['HEIGHT'], $filedir, $file, $view['CONSTRAINWIDTH'], $view['CONSTRAINHEIGHT'], $view['WIDTHCROP'], $view['HEIGHTCROP']);
if ($info) {
$file = new File($fileinfo['OBJECTID'], $fileinfo['VERSION']);
$file->views->addGenerated($view["ID"], $info["WIDTH"], $info["HEIGHT"], $info["VIEWTYPE"]);
}
return true;
}
示例3: __construct
/**
* Constructor of the Reftracker class
*/
function __construct()
{
$this->_db = sYDB();
$this->_uid =& sUserMgr()->getCurrentUserID();
$this->_internPrefix = str_replace("/", '\\/', sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'));
}
示例4: session_write_close
<?php
session_write_close();
while (@ob_end_clean()) {
}
ini_set("zlib.output_compression", "Off");
// Normalize everything and remove webroot-prefix
$request_path = $this->request->path;
$webroot_path = explode('/', rtrim(ltrim((string) sConfig()->getVar("CONFIG/DIRECTORIES/WEBROOT"), '/'), '/'));
$request_path_string = implode('/', $request_path);
$webroot_path_string = implode('/', $webroot_path);
if (strpos($request_path_string, "download/") === 0) {
// Remove leading 'page/'
$request_path_string = substr($request_path_string, strlen("download/"));
}
if (strpos($request_path_string, $webroot_path_string . '/') === 0) {
// Remove leading webroot-prefix
$request_path_string = substr($request_path_string, strlen($webroot_path_string . '/'));
}
$request_path = explode('/', "download/" . $request_path_string);
$fileId = $request_path[1];
$prefix = $request_path[2];
if ($fileId == 'download') {
$fileId = $request_path[2];
$prefix = $request_path[3];
}
if ($prefix == "YGSOURCE") {
unset($prefix);
}
// Check if id is pname
if ($request_path[0] == $request_path[1]) {
示例5: sendEmail
public function sendEmail($emailData)
{
$mail = new PHPMailer();
if ((bool) sConfig()->getVar('CONFIG/MAILINGS/DISABLE')) {
return true;
}
// Obtain userdata
$user = new User($emailData['USER_ID']);
$userInfo = $user->get();
$userInfo['PROPERTIES'] = $user->properties->getValues($emailData['USER_ID']);
// Obtain mailingdata
$mailingMgr = new MailingMgr();
$mailing = $mailingMgr->getMailing($emailData['MAILING_ID']);
if ($emailData['IS_TEST']) {
$mailingInfo = $mailing->get();
$mailingVersion = $mailingInfo['VERSION'];
} else {
$mailingVersion = $mailing->getLatestApprovedVersion();
$mailing = $mailingMgr->getMailing($emailData['MAILING_ID'], $mailingVersion);
$mailingInfo = $mailing->get();
}
$templateMgr = new Templates();
$userId = $userInfo['ID'];
$userEmail = $userInfo['PROPERTIES']['EMAIL'];
$userFirstName = $userInfo['PROPERTIES']['FIRSTNAME'];
$userLastName = $userInfo['PROPERTIES']['LASTNAME'];
$userName = trim($userFirstName . ' ' . $userLastName);
$userCompany = $userInfo['PROPERTIES']['COMPANY'];
$userDepartment = $userInfo['PROPERTIES']['COMPANY'];
$templateInfo = $templateMgr->getTemplate($mailingInfo['TEMPLATEID']);
$userInfo['PROPERTIES']['FULLNAME'] = trim($userFirstName . ' ' . $userLastName);
sSmarty()->clear_assign('recipient');
sSmarty()->assign('recipient', $userInfo);
sSmarty()->clear_assign('user');
sSmarty()->assign('user', $userInfo['PROPERTIES']);
sApp()->output = '';
$emailData['FROM'] = $mailingInfo['FROM_EMAIL'];
$emailData['FROM_NAME'] = $mailingInfo['FROM_NAME'];
$emailData['FROM_REPLYTO'] = $mailingInfo['FROM_REPLYTO'];
$emailData['FROM_SENDER'] = $mailingInfo['FROM_SENDER'];
$emailData['ENCODING'] = $mailingInfo['ENCODING'];
if ($emailData['ENCODING'] == '') {
$emailData['ENCODING'] = 'base64';
}
$emailData['SUBJECT'] = $this->replaceUserdataVars($mailingInfo['SUBJECT'], $emailData['USER_ID']);
$emailData['BODY_TEXT'] = $this->replaceUserdataVars($mailingInfo['FALLBACK_TEXT'], $emailData['USER_ID']);
// Set special smarty delimiters
sSmarty()->left_delimiter = '[!';
sSmarty()->right_delimiter = '!]';
// Parse subject with smarty
$emailData['SUBJECT'] = sSmarty()->fetch('var:' . $emailData['SUBJECT']);
//$emailData['BODY_TEXT'] = sSmarty()->fetch('var:'.$emailData['BODY_TEXT']);
// Reset smarty delimiters
sSmarty()->left_delimiter = '{';
sSmarty()->right_delimiter = '}';
$mailingId = $emailData['MAILING_ID'];
include getrealpath(dirname(__FILE__) . '/../../output/mailing.php');
if ($templateInfo['FILENAME']) {
$emailhtml = sApp()->output;
$emailhtml = str_replace("\"/neptun/neptun.php", "\"" . $this->request->prefix . "://" . $this->request->http_host . $this->request->script_name, $emailhtml);
$emailhtml = $this->replaceUserdataVars($emailhtml, $emailData['USER_ID']);
$emailData['BODY_HTML'] = $emailhtml;
} else {
$emailData['BODY_HTML'] = NULL;
}
sApp()->output = '';
$smtpServer = (string) sConfig()->getVar('CONFIG/MAILINGS/SMTP');
if ($smtpServer) {
$mail->IsSMTP();
$mail->Host = $smtpServer;
}
if ($emailData['ENCODING']) {
$mail->Encoding = $emailData['ENCODING'];
}
if ($emailData['CHARSET']) {
$mail->CharSet = $emailData['CHARSET'];
}
if ($emailData['FROM']) {
$mail->From = $emailData['FROM'];
}
if ($emailData['FROM_NAME']) {
$mail->FromName = $emailData['FROM_NAME'];
}
if ($emailData['FROM_REPLYTO']) {
$mail->AddReplyTo($emailData['FROM_REPLYTO']);
}
if ($emailData['FROM_SENDER']) {
$mail->Sender = $emailData['FROM_SENDER'];
}
if ($emailData['SUBJECT']) {
$mail->Subject = $emailData['SUBJECT'];
}
if ($emailData['BODY_HTML']) {
$mail->Body = $emailData['BODY_HTML'];
$mail->IsHTML(true);
}
if ($emailData['BODY_TEXT'] && !$emailData['BODY_HTML']) {
$mail->Body = $emailData['BODY_TEXT'];
$mail->IsHTML(false);
}
//.........这里部分代码省略.........
示例6: min
$ret *= 1024;
case 'T':
$ret *= 1024;
case 'G':
$ret *= 1024;
case 'M':
$ret *= 1024;
case 'K':
$ret *= 1024;
break;
}
return $ret;
}
$max_uploadsize = 0;
$max_uploadsize = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
$max_uploadsize = $max_uploadsize / (1024 * 1024) . 'mb';
// Check if a custom login-url is set
$customLoginURL = (string) $this->config->getVar('CONFIG/DIRECTORIES/LOGINURL');
if (trim($customLoginURL) != '') {
$smarty->assign("base", trim($customLoginURL) . basename($this->request->script_name) . '/');
}
$smarty->assign("webroot", sApp()->webroot);
$smarty->assign("cookiedomain", (string) $this->config->getVar("CONFIG/SESSION/COOKIES/DOMAIN"));
$smarty->assign("devmode", sConfig()->getVar("CONFIG/DEVMODE"));
$smarty->assign("max_uploadsize", $max_uploadsize);
$smarty->assign("guiSyncInterval", sConfig()->getVar("CONFIG/GUISYNC_INTERVAL"));
$smarty->assign("guiSyncTimeout", sConfig()->getVar("CONFIG/GUISYNC_TIMEOUT"));
$smarty->assign("objectRelockInterval", sConfig()->getVar("CONFIG/OBJECTRELOCK_INTERVAL"));
$smarty->assign("userinfo", $userinfo);
$smarty->assign("icon", $icons->icon);
$smarty->display('file:' . $this->page_template);
示例7: getList
/**
* Gets a list of Files
*
* @param int $fileId (optional) Id of the parent File from which the list will be created
* @param array $filter (optional, may be combined) If SUBNODES, only subnodes of the specified File will be returned<br>
* if TRASHCAN, only items in the Trash will be returned<br>
* if FOLDERS, only folders will be returned
* @param string $sort (optional) "ORDER BY" Sql clause
* @param int $maxLevel (optional) Specifies the maximum level of nodes to get
* @param int $usergroupId (optional) Return List for a specfic Usergroup Id
* @param array $filterArray Array of filters for the SQL query
* @return array|false Array of Files or FALSE in case of an error
* @throws Exception
*/
function getList($fileId = 0, $filter = array(), $sort = 'group2.LFT', $maxLevel = 0, $usergroupId = 0, $filterArray)
{
$fileId = (int) $fileId;
$sort = sanitize($sort);
$maxLevel = (int) $maxLevel;
$usergroupId = (int) $usergroupId;
$rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID");
if ($fileId == 0) {
$fileId = $this->tree->getRoot();
}
if (in_array("SUBNODES", $filter)) {
$myinfo = $this->tree->getAll($fileId);
$myleft = $myinfo["LFT"];
$myrgt = $myinfo["RGT"];
$subnodesql = " AND (group2.LFT > {$myleft} AND group2.RGT < {$myrgt}) ";
if (!$myinfo) {
return false;
}
}
if (in_array("FOLDERS", $filter)) {
$subnodesql .= " AND (prop.FOLDER = 1)";
}
// Surpress items in trashcan if not explicitly asked for
if (in_array("TRASHCAN", $filter)) {
$subnodesql .= " AND prop.DELETED = 1 AND prop.FOLDER = 0";
} else {
$subnodesql .= " AND prop.DELETED = 0";
}
// Check if special filter was suppplied
$filterOrder = 'ORDER BY ' . $sort;
if ($filterArray) {
$filterSelect = $filterFrom = $filterWhere = $filterLimit = $filterOrder = '';
buildBackendFilter('FilesSearchCB', $filterArray, $filterSelect, $filterFrom, $filterWhere, $filterLimit, $filterOrder);
$subnodesql .= $filterWhere;
}
if ($maxLevel > 0) {
$maxlevelsql = " AND (group2.LEVEL <= {$maxLevel}) AND (group1.LEVEL <= {$maxLevel})";
}
$perm_sql_select = ", MAX(perm.RREAD) AS RREAD, MAX(perm.RWRITE) AS RWRITE, MAX(perm.RDELETE) AS RDELETE, MAX(perm.RSUB) AS RSUB, MAX(perm.RSTAGE) AS RSTAGE, MAX(perm.RMODERATE) AS RMODERATE, MAX(perm.RCOMMENT) AS RCOMMENT";
$perm_sql_from = " LEFT JOIN yg_files_permissions AS perm ON perm.OID = group2.ID";
if ($usergroupId > 0) {
$perm_sql_from .= " AND (perm.USERGROUPID = " . $usergroupId . ")";
} else {
$perm_sql_where = " AND (";
$roles = $this->permissions->getUsergroups();
for ($r = 0; $r < count($roles); $r++) {
$perm_sql_where .= "(perm.USERGROUPID = " . (int) $roles[$r]["ID"] . ") ";
if (count($roles) - $r > 1) {
$perm_sql_where .= " OR ";
}
}
$perm_sql_where .= ") ";
$perm_sql_where .= " AND ((RREAD >= 1) OR (perm.USERGROUPID = {$rootGroupId})) ";
}
$sql = "SELECT\n\t\t\t\t\tgroup2.LFT,\n\t\t\t\t\tgroup2.RGT,\n\t\t\t\t\tgroup2.VERSIONPUBLISHED,\n\t\t\t\t\tgroup2.ID,\n\t\t\t\t\tgroup2.LEVEL AS LEVEL,\n\t\t\t\t\tgroup2.PARENT AS PARENT,\n\t\t\t\t\tMAX(prop.VERSION) AS VERSION,\n\t\t\t\t\tprop.FOLDER AS FOLDER,\n\t\t\t\t\tprop.FILENAME AS FILENAME,\n\t\t\t\t\tprop.FILETYPE AS FILETYPE,\n\t\t\t\t\tprop.FILESIZE AS FILESIZE,\n\t\t\t\t\tSUBSTRING_INDEX(prop.FILENAME, '.', -1) AS EXTENSION,\n\t\t\t\t\tpv.*,\n\t\t\t\t\tprop.CREATEDTS,\n\t\t\t\t\tprop.CHANGEDTS,\n\t\t\t\t\tprop.CREATEDBY,\n\t\t\t\t\tprop.CHANGEDBY\n\t\t\t\t\t{$perm_sql_select}\n\t\t\t\tFROM\n\t\t\t\t\t({$this->table} AS group1, {$this->table} AS group2, yg_files_properties AS prop)\n\t\t\t\t\t{$perm_sql_from}\n\t\t\t\tLEFT JOIN yg_files_propsv AS pv\n\t\t\t\t\tON pv.OID = prop.ID\n\t\t\t\tWHERE\n\t\t\t\t\t((group2.LFT >= group1.LFT) AND (group2.LFT <= group1.RGT)) AND\n\t\t\t\t\t(group2.ID = prop.OBJECTID) AND\n\t\t\t\t\t(prop.VERSION = (SELECT MAX( rgt.VERSION ) FROM yg_files_properties AS rgt WHERE (prop.OBJECTID = rgt.OBJECTID)))\n\t\t\t\t\t{$perm_sql_where}\n\t\t\t\t\t{$maxlevelsql}\n\t\t\t\t\t{$subnodesql}\n\t\t\t\tGROUP BY\n\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID\n\t\t\t\t{$filterOrder} {$filterLimit};";
$dbr = sYDB()->Execute($sql);
if ($dbr === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$blaetter = $dbr->GetArray();
return $blaetter;
}
示例8: User
<?php
$tmpUser = new User(sUserMgr()->getCurrentUserID());
$tmpUserInfo = $tmpUser->get();
$adminAllowed = $tmpUser->checkPermission('RUPDATER');
if ($adminAllowed) {
session_start();
//sApp()
$this->yeager_version = $versionp;
//$this->yeager_revision = YEAGER_REVISION;
//$this->yeager_date = YEAGER_DATE;
$databaseInfo = sConfig()->getVars('CONFIG/DB');
$databaseHost = $databaseInfo[0]['host'];
$databaseHost = explode(':', $databaseHost);
if (count($databaseHost) > 1) {
$databasePort = $databaseHost[1];
$databaseHost = $databaseHost[0];
} else {
$databasePort = '3306';
$databaseHost = $databaseHost[0];
}
$_SESSION['APPINFO'] = array('VERSION' => $this->yeager_version, 'REVISION' => $this->yeager_revision, 'DATABASE_SERVER' => $databaseHost, 'DATABASE_PORT' => $databasePort, 'DATABASE_USER' => $databaseInfo[0]['user'], 'DATABASE_PASSWORD' => $databaseInfo[0]['password'], 'DATABASE_NAME' => $databaseInfo[0]['db'], 'PATH_BASE' => dirname($_SERVER['SCRIPT_FILENAME']) . '/');
$updateMgr = new Updater();
$updates = $updateMgr->getUpdates();
$currVersion = $updateMgr->current_version_string;
$currRevision = $this->yeager_revision;
//$currDate = explode('-', substr(YEAGER_DATE, 6, 11));
//$currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]);
$currDate = '';
}
$winID = $this->request->parameters['win_no'];
示例9: glob
$passwordInsecure = true;
}
}
if ($emailChanged || $passwordChanged) {
$this->session->setPSessionVar('isvalidated', true);
$this->session->refrehSessionCookie();
}
if (file_exists($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-temp_picture.jpg')) {
$cachedImages = glob($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-*x*.jpg');
foreach ($cachedImages as $cachedImagesItem) {
@unlink($cachedImagesItem);
}
rename($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-temp_picture.jpg', $this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-picture.jpg');
$user->properties->setValue('PROFILEPICTURE', sUserMgr()->getCurrentUserID());
}
$internPrefix = (string) sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX');
$userpic = $internPrefix . '/userimage/' . sUserMgr()->getCurrentUserID() . '/48x48?rnd=' . rand();
if ($confirmed == 'true' && $positive == 'false' || !$hadError) {
$koala->queueScript('Koala.windows[\'wid_' . $winid . '\'].remove();');
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'firstname', $firstname);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'lastname', $lastname);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'name', $firstname . ' ' . $lastname);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'email', $email);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'company', $company);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGEBGIMAGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'picture', $userpic);
$jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'CLEAR_USERINFOS', sGuiUS(), NULL);
$koala->queueScript('Koala.userSettings.weekStart = \'' . $weekstart . '\';');
} elseif ($hadError) {
foreach ($errorFields as $errorField) {
$koala->queueScript('$(\'wid_' . $winid . '_' . $errorField . '\').addClassName(\'error\');');
}
示例10: getPreviewPath
/**
* Gets the path of the Template preview
*
* @param int $templateId Template Id
* @return string Template preview path
*/
function getPreviewPath($templateId)
{
// Check for template preview
$templatePreviewDir = getRealpath(sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR')) . '/';
$foundFiles = glob($templatePreviewDir . $templateId . '-*');
if ($foundFiles !== false && count($foundFiles) > 0) {
$previewFile = explode('/', $foundFiles[0]);
$previewFile = $previewFile[count($previewFile) - 1];
$previewDir = sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR');
}
return $previewDir . $previewFile;
}
示例11: glob
}
}
if (count($found_temp_template_files) > 0 && $templatechanged) {
// Delete old files
$old_template_files = glob($templatedir . $objectID . '-*');
foreach ($old_template_files as $old_template_file) {
unlink($old_template_file);
}
// Rename temp file to real filename
$real_filename = basename(str_replace('TMP_' . $objectID . '-', '', $found_temp_template_files[count($found_temp_template_files) - 1]));
$real_filename = explode('-', $real_filename);
array_shift($real_filename);
$real_filename = implode('', $real_filename);
rename($found_temp_template_files[count($found_temp_template_files) - 1], $templatedir . $real_filename);
// Get new file mode to set from configfile (and set it)
$newFileMode = octdec(sConfig()->getVar('CONFIG/UPLOAD_PERMISSIONS'));
if ($newFileMode) {
chmod($templatedir . $real_filename, $newFileMode);
}
$found_temp_template_files_to_del = glob($templatedir . 'TMP_' . $objectID . '-*');
foreach ($found_temp_template_files_to_del as $found_temp_template_file_to_del) {
unlink($found_temp_template_file_to_del);
}
$templateMgr->setPath($objectID, '');
$templateMgr->setFilename($objectID, basename($real_filename));
// Check for added/removed contentareas
$filecontentareas = $templateMgr->getContentareasFromFile($objectID);
$contentareas = $templateMgr->getContentareas($objectID);
$a = 0;
$r = 0;
$afilecontentareas = array();
示例12: remove
/**
* Removes a Usergroup
*
* @param int $usergroupId Usergroup Id
* @return bool TRUE on success or FALSE in case of an error
*/
function remove($usergroupId)
{
if ($this->permissions->check($this->_uid, 'RUSERGROUPS')) {
$usergroupId = (int) $usergroupId;
if ($usergroupId == (int) sConfig()->getVar('CONFIG/SYSTEMUSERS/ROOTGROUPID')) {
return false;
}
// do not allow root Usergroup to be deleted
$sql = "DELETE FROM " . $this->_table . " WHERE ID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_user_lnk_usergroups WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_contentblocks_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_entrymasks_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_files_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_filetypes_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_mailing_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_tags_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_templates_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_usergroups_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_views_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
$sql = "DELETE FROM yg_mailing_lnk_usergroups WHERE RID = ?;";
sYDB()->Execute($sql, $usergroupId);
$allSites = sSites()->getList();
foreach ($allSites as $allSitesItem) {
$sql = "DELETE FROM yg_site_" . $allSitesItem['ID'] . "_permissions WHERE USERGROUPID = ?;";
sYDB()->Execute($sql, $usergroupId);
}
return true;
} else {
return false;
}
}
示例13: getUpdates
/**
* Gets all outstanding updates
*
* @return array Array containing update information with version/revision/date information
*/
function getUpdates()
{
$currVersionNumeric = $this->current_version;
$postFields = array('INFO' => serialize($_SERVER), 'VERSION' => $currVersionNumeric);
$xmlString = getStringFromURL(YEAGER_UPDATER_URL . '?' . http_build_query($postFields), (int) YEAGER_UPDATER_TIMEOUT);
if ($xmlString !== false) {
// Online Mode
$updateDataXML = new SimpleXMLElement($xmlString);
$updatesArray = array();
foreach ($updateDataXML->update as $updateItem) {
$currDate = explode('-', (string) $updateItem->date);
$currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]);
$updateVersion = prettifyVersionString((string) $updateItem->version);
$updateVersionNumeric = (int) str_replace('.', '', (string) $updateItem->version);
$updatesArrayItem = array('TITLE' => stripCDATA((string) $updateItem->title), 'DATE' => $currDate, 'VERSION' => $updateVersion, 'VERSION_NUMERIC' => $updateVersionNumeric, 'REVISION' => (string) $updateItem->revision, 'DESCRIPTION' => stripCDATA((string) $updateItem->description), 'URL' => (string) $updateItem->url_update);
foreach ($updateItem->dependencies->version as $dependencyItem) {
$updatesArrayItem['DEPENDENCIES'][] = (string) $dependencyItem;
}
$updatesArray[] = $updatesArrayItem;
}
} else {
// Offline Mode
$updatesDirectory = sApp()->approot . sConfig()->getVar('CONFIG/DIRECTORIES/UPDATES');
$updatePackages = glob($updatesDirectory . 'yeager_*_r*.php');
// Read out package information
$updatesArray = array();
foreach ($updatePackages as $updatePackage) {
$currArchive = new PayloadTar($updatePackage, true);
$metaData = $currArchive->extractInString('installer/config.xml');
$metaDataXML = new SimpleXMLElement($metaData);
$currDate = explode('-', (string) $metaDataXML->date);
$currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]);
$updateVersion = prettifyVersionString((string) $metaDataXML->version);
$updateVersionNumeric = (int) str_replace('.', '', (string) $metaDataXML->version);
$updatesArrayItem = array('TITLE' => stripCDATA((string) $metaDataXML->title), 'DATE' => $currDate, 'VERSION' => $updateVersion, 'VERSION_NUMERIC' => $updateVersionNumeric, 'REVISION' => (string) $metaDataXML->revision, 'DESCRIPTION' => str_replace('\\n', "\n", stripCDATA((string) $metaDataXML->description)), 'URL' => 'file://' . $updatePackage);
foreach ($metaDataXML->dependencies->version as $dependencyItem) {
$updatesArrayItem['DEPENDENCIES'][] = (string) $dependencyItem;
}
$updatesArray[] = $updatesArrayItem;
}
}
$neededUpdates = array();
foreach ($updatesArray as $allUpdatesItem) {
if ($allUpdatesItem['VERSION_NUMERIC'] > $currVersionNumeric) {
$neededUpdates[] = $allUpdatesItem;
}
}
$updatesArray = $neededUpdates;
usort($updatesArray, function ($a, $b) {
if ($a['REVISION'] == $b['REVISION']) {
return 0;
}
return version_compare($b['VERSION'], $a['VERSION'], '>=') ? -1 : 1;
/*return true;*/
});
return $updatesArray;
}
示例14: getWithoutUsergroup
/**
* Gets all Users without an assigned Usergroup
*
* @param string $order SQL-order-by-clause
* @param string $sort SQL-sort-clause
* @param string $limit SQL-limit-clause
* @param string $searchText (optional) Searchtext
* @return array|bool Array of Users or FALSE in case of an error
*/
function getWithoutUsergroup($order = '', $sort = 'ASC', $limit = '', $searchText = NULL)
{
if (sUsergroups()->permissions->check($this->_uid, 'RUSERS')) {
$anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID");
$order = sYDB()->escape_string(sanitize($order));
$sort = sYDB()->escape_string(sanitize($sort));
$limit = sYDB()->escape_string(sanitize($limit));
$sqlargs = array();
array_push($sqlargs, $anonGroupId);
$searchSQL = '';
if (strlen($searchText)) {
$searchText = "%" . sYDB()->escape_string(sanitize($searchText)) . "%";
$searchSQL = "AND (\n\t\t\t\t\t\t\t\t(yg_user_propsv.LASTNAME LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.FIRSTNAME LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.EMAIL LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.COMPANY LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.DEPARTMENT LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.FAX LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.PHONE LIKE ?)\n\t\t\t\t\t\t\t)";
array_push($sqlargs, $searchText, $searchText, $searchText, $searchText, $searchText, $searchText, $searchText);
}
if (strlen($order) < 1) {
$ordersql = "LASTNAME";
}
if (strlen($order) > 0) {
$ordersql = $order;
}
if ($order == "FIRSTNAME") {
$ordersql = "NAME ASC, EMAIL ASC";
}
if ($sort == "ASC") {
$sortsql = "ASC";
} else {
$sortsql = "DESC";
}
if ($limit) {
$limitarr = explode(",", $limit);
$limitsql = "LIMIT " . (int) $limitarr[0] . "," . (int) $limitarr[1];
}
$sql = "SELECT\n\t\t\t\t\t\tu.LOGIN AS LOGIN,\n\t\t\t\t\t\tu.PASSWORD AS PASSWORD,\n\t\t\t\t\t\tu.ID AS ID,\n\t\t\t\t\t\tu.ID AS UID,\n\t\t\t\t\t\tyg_user_propsv.LASTNAME AS LASTNAME,\n\t\t\t\t\t\tyg_user_propsv.FIRSTNAME AS FIRSTNAME,\n\t\t\t\t\t\tyg_user_propsv.EMAIL AS EMAIL,\n\t\t\t\t\t\tyg_user_propsv.COMPANY AS COMPANY,\n\t\t\t\t\t\tyg_user_propsv.DEPARTMENT AS DEPARTMENT,\n\t\t\t\t\t\tyg_user_propsv.FAX AS FAX,\n\t\t\t\t\t\tyg_user_propsv.PHONE AS PHONE,\n\t\t\t\t\t\tcount(lnk.UID) AS GROUPCOUNT,\n\t\t\t\t\t\tlnk2.USERGROUPID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tyg_user as u\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_lnk_usergroups as lnk ON u.ID = lnk.UID\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_lnk_usergroups as lnk2 ON (u.ID = lnk2.UID) AND ((lnk2.USERGROUPID = ?) OR (lnk2.USERGROUPID = NULL))\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_propsv ON u.ID = yg_user_propsv.OID\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t1 {$searchSQL}\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tu.ID\n\t\t\t\t\tHAVING\n\t\t\t\t\t\t(GROUPCOUNT = 1 AND lnk2.USERGROUPID = ?) OR\n\t\t\t\t\t\t(GROUPCOUNT = 0)\n\t\t\t\t\tORDER BY `{$ordersql}` {$sortsql} {$limitsql};";
array_push($sqlargs, $anonGroupId);
array_unshift($sqlargs, $sql);
$dbr = call_user_func_array(array(sYDB(), 'Execute'), $sqlargs);
if ($dbr === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$resultarray = $dbr->GetArray();
return $resultarray;
} else {
return false;
}
}
示例15: calcPName
/**
* Calculates a unique permanent name for the specified Site
*
* @param int $id Site Id
* @param string $iteration (optional) Iteration
* @param string $name (optional) Name to calculate the PName from
* @return string Permanent name
*/
function calcPName($id, $iteration = "", $name = '')
{
$siteID = (int) $id;
$siteInfo = $this->get($siteID);
$siteName = $siteInfo['NAME'];
if ($name) {
$siteName = $name;
}
if ((int) sConfig()->getVar("CONFIG/CASE_SENSITIVE_URLS") == 0) {
$siteName = strtolower($siteName);
}
$PName = $this->filterPName($siteName);
if ($iteration != '') {
$checkPinfo = $this->getByPName($PName . '_' . $iteration);
} else {
$checkPinfo = $this->getByPName($PName);
}
if ($checkPinfo['ID'] == $siteID) {
if ($iteration != '') {
return $PName . '_' . $iteration;
} else {
return $PName;
}
} else {
if ($checkPinfo['ID'] == NULL) {
if ($iteration != '') {
return $PName . '_' . $iteration;
} else {
return $PName;
}
} else {
if ($iteration == '') {
$iteration = 1;
}
return $this->calcPName($siteID, ++$iteration);
}
}
}