本文整理汇总了PHP中iaUtil类的典型用法代码示例。如果您正苦于以下问题:PHP iaUtil类的具体用法?PHP iaUtil怎么用?PHP iaUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iaUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$entry = array('name' => iaUtil::checkPostParam('name'), 'item' => iaUtil::checkPostParam('item'), 'collapsible' => iaUtil::checkPostParam('collapsible'), 'collapsed' => iaUtil::checkPostParam('collapsed'), 'tabview' => iaUtil::checkPostParam('tabview'), 'tabcontainer' => iaUtil::checkPostParam('tabcontainer'));
iaUtil::loadUTF8Functions('ascii', 'bad', 'validation');
if (iaCore::ACTION_ADD == $action) {
if (!utf8_is_ascii($entry['name'])) {
$this->addMessage('ascii_required');
} else {
$entry['name'] = strtolower($entry['name']);
}
if (!$this->getMessages() && !preg_match('/^[a-z0-9\\-_]{2,50}$/', $entry['name'])) {
$this->addMessage('name_is_incorrect');
}
if (empty($data['item'])) {
$this->addMessage('at_least_one_item_should_be_checked');
}
$entry['order'] = $this->_iaDb->getMaxOrder(iaField::getTableGroups()) + 1;
}
foreach ($this->_iaCore->languages as $code => $language) {
if ($data['titles'][$code]) {
if (!utf8_is_valid($data['titles'][$code])) {
$data['titles'][$code] = utf8_bad_replace($data['titles'][$code]);
}
} else {
$this->addMessage($language['title'] . ': ' . iaLanguage::get('title_incorrect'), false);
}
if ($data['description'][$code]) {
if (!utf8_is_valid($data['description'][$code])) {
$data['description'][$code] = utf8_bad_replace($data['description'][$code]);
}
}
}
return !$this->getMessages();
}
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:34,代码来源:fieldgroups.php
示例2: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$iaAcl = $this->_iaCore->factory('acl');
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
$entry['id'] = $iaAcl->obtainFreeId();
$entry['assignable'] = $data['visible'];
$entry['visible'] = $data['visible'];
if (iaCore::ACTION_ADD == $action) {
if (empty($data['name'])) {
$this->addMessage('error_usergroup_incorrect');
} else {
$entry['name'] = strtolower(iaSanitize::paranoid($data['name']));
if (!iaValidate::isAlphaNumericValid($entry['name'])) {
$this->addMessage('error_usergroup_incorrect');
} elseif ($this->_iaDb->exists('`name` = :name', array('name' => $entry['name']))) {
$this->addMessage('error_usergroup_exists');
}
}
}
foreach ($this->_iaCore->languages as $iso => $title) {
if (empty($data['title'][$iso])) {
$this->addMessage(iaLanguage::getf('error_lang_title', array('lang' => $this->_iaCore->languages[$iso])), false);
} elseif (!utf8_is_valid($data['title'][$iso])) {
$data['title'][$iso] = utf8_bad_replace($data['title'][$iso]);
}
}
if (!$this->getMessages()) {
foreach ($this->_iaCore->languages as $iso => $title) {
iaLanguage::addPhrase('usergroup_' . $entry['name'], $data['title'][$iso], $iso);
}
}
return !$this->getMessages();
}
开发者ID:nicefirework,项目名称:subrion,代码行数:33,代码来源:usergroups.php
示例3: _launch
protected function _launch($id)
{
//$this->getHelper()->run($id);
// implemented via remote request because potentially some package's cron task
// may use front classes which will cause conflicts if executed from backend side.
// otherwise, the only call of iaCore::run() would be enough
$cronUrl = IA_CLEAR_URL . 'cron/?_t&t=' . (int) $id;
iaUtil::getPageContent($cronUrl, 300);
//
$this->_iaCore->iaView->setMessages(iaLanguage::get('scheduled_task_ran'), iaView::SUCCESS);
iaUtil::go_to($this->getPath());
}
开发者ID:rentpad,项目名称:subrion,代码行数:12,代码来源:scheduled-tasks.php
示例4: titleAlias
public function titleAlias($title)
{
$result = iaSanitize::tags($title);
$this->iaCore->factory('util');
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
utf8_is_ascii($result) || ($result = utf8_to_ascii($result));
$result = preg_replace('#' . self::ALIAS_SUFFIX . '$#i', '', $result);
$result = iaSanitize::alias($result);
$result = substr($result, 0, 150);
// the DB scheme applies this limitation
$result .= self::ALIAS_SUFFIX;
return $result;
}
开发者ID:kreativmind,项目名称:subrion,代码行数:13,代码来源:ia.admin.blog.php
示例5: _gridRead
protected function _gridRead($params)
{
switch ($_POST['action']) {
case 'delete-file':
return $this->_deleteFile($_POST);
case 'remove-installer':
$result = iaUtil::deleteFile(IA_HOME . 'install/modules/module.install.php');
return array('error' => !$result, 'message' => iaLanguage::get($result ? 'deleted' : 'error'));
default:
$result = array();
$this->_iaCore->startHook('phpAdminActionsJsonHandle', array('action' => $_POST['action'], 'output' => &$result));
return $result;
}
}
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:14,代码来源:actions.php
示例6: smarty_function_preventCsrf
function smarty_function_preventCsrf($params, &$smarty)
{
// support several post forms in the page
$calledTimes = 0;
if (!isset($_SESSION['prevent_csrf']) || !is_array($_SESSION['prevent_csrf'])) {
$_SESSION['prevent_csrf'] = array();
}
$count = count($_SESSION['prevent_csrf']);
if ($count > 30) {
$_SESSION['prevent_csrf'] = isset($_SESSION['prevent_csrf'][$count - 1]) ? array($_SESSION['prevent_csrf'][$count - 1]) : array();
}
$_SESSION['prevent_csrf'][] = $token = iaUtil::generateToken();
$calledTimes++;
return '<input type="hidden" name="prevent_csrf" value="' . $token . '" />';
}
开发者ID:kamilklkn,项目名称:subrion,代码行数:15,代码来源:function.preventCsrf.php
示例7: _postSaveEntry
protected function _postSaveEntry(array &$entry, array $data, $action)
{
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
foreach ($this->_iaCore->languages as $code => $language) {
$title = utf8_is_valid($data['title'][$code]) ? $data['title'][$code] : utf8_bad_replace($data['title'][$code]);
iaLanguage::addPhrase('usergroup_' . $entry['name'], $title, $code);
}
// copy privileges
$copyFrom = isset($data['copy_from']) ? (int) $data['copy_from'] : 0;
if ($copyFrom) {
$this->_iaDb->setTable('acl_privileges');
$rows = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, "`type_id` = '{$copyFrom}' AND `type` = 'group'");
foreach ($rows as $key => &$row) {
$row['type_id'] = $entry['id'];
unset($rows[$key]['id']);
}
$this->_iaDb->insert($rows);
$this->_iaDb->resetTable();
}
}
开发者ID:kamilklkn,项目名称:subrion,代码行数:20,代码来源:usergroups.php
示例8: snippet
public static function snippet($text, $length = 600)
{
$iaUtil = iaCore::instance()->factory('util');
iaUtil::loadUTF8Functions();
// Strip HTML and BB codes
$pattern = '#(\\[\\w+[^\\]]*?\\]|\\[\\/\\w+\\]|<\\w+[^>]*?>|<\\/\\w+>)#i';
$text = preg_replace($pattern, '', $text);
// remove repeated spaces and new lines
$text = preg_replace('/\\s{2,}/', PHP_EOL, $text);
$text = trim($text, PHP_EOL);
if (utf8_strlen($text) > $length) {
$text = utf8_substr($text, 0, $length);
$_tmp = utf8_decode($text);
if (preg_match('#.*([\\.\\s]).*#s', $_tmp, $matches, PREG_OFFSET_CAPTURE)) {
$end_pos = $matches[1][1];
$text = utf8_substr($text, 0, $end_pos + 1);
$text .= ' ...';
}
}
return $text;
}
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:21,代码来源:ia.core.sanitize.php
示例9: _postSaveEntry
protected function _postSaveEntry(array &$entry, array $data, $action)
{
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
foreach ($this->_iaCore->languages as $code => $language) {
$title = iaSanitize::tags($data['title'][$code]);
utf8_is_valid($title) || ($title = utf8_bad_replace($title));
iaLanguage::addPhrase('usergroup_' . $entry['name'], $title, $code);
}
// copy privileges
if ($data['copy_from']) {
$this->_iaDb->setTable('acl_privileges');
$where = '`type_id` = :id AND `type` = :type';
$this->_iaDb->bind($where, array('id' => (int) $data['copy_from'], 'type' => 'group'));
$rows = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, $where);
foreach ($rows as $key => &$row) {
$row['type_id'] = $this->getEntryId();
unset($rows[$key]['id']);
}
$this->_iaDb->insert($rows);
$this->_iaDb->resetTable();
}
}
开发者ID:rentpad,项目名称:subrion,代码行数:22,代码来源:usergroups.php
示例10: createInvoice
/**
* Generates invoice for an item
*
* @param string $title plan title
* @param double $cost plan cost
* @param string $itemName item name
* @param array $itemData item details
* @param string $returnUrl return URL
* @param int $planId plan id
* @param bool $return true redirects to invoice payment URL
*
* @return string
*/
public function createInvoice($title, $cost, $itemName = 'members', $itemData = array(), $returnUrl = '', $planId = 0, $return = false)
{
if (!isset($itemData['id'])) {
$itemData['id'] = 0;
}
$title = empty($title) ? iaLanguage::get('plan_title_' . $planId) : $title;
$title .= $itemData['id'] ? ' - #' . $itemData['id'] : '';
$transactionId = uniqid('t');
$transaction = array('member_id' => (int) (isset($itemData['member_id']) && $itemData['member_id'] ? $itemData['member_id'] : iaUsers::getIdentity()->id), 'item' => $itemName, 'item_id' => $itemData['id'], 'amount' => $cost, 'currency' => $this->iaCore->get('currency'), 'sec_key' => $transactionId, 'status' => self::PENDING, 'plan_id' => $planId, 'return_url' => $returnUrl, 'operation' => $title, 'date' => date(iaDb::DATETIME_FORMAT));
$result = (bool) $this->iaDb->insert($transaction, null, $this->getTable());
$return || iaUtil::go_to(IA_URL . 'pay' . IA_URL_DELIMITER . $transactionId . IA_URL_DELIMITER);
return $result ? $transactionId : false;
}
开发者ID:bohmszi,项目名称:kdbe_cms,代码行数:26,代码来源:ia.core.transaction.php
示例11: _indexPage
protected function _indexPage(&$iaView)
{
if ('phrases' == $iaView->get('name')) {
iaBreadcrumb::preEnd(iaLanguage::get('languages'), IA_ADMIN_URL . 'languages/');
$iaView->assign('action', 'phrases');
$iaView->display('languages');
return true;
}
$action = isset($this->_iaCore->requestPath[0]) ? $this->_iaCore->requestPath[0] : 'list';
$iaView->assign('action', $action);
switch ($action) {
case 'search':
$pageCaption = iaLanguage::get('search_in_phrases');
break;
case 'download':
$pageCaption = iaLanguage::get('export_language');
if (isset($_POST['lang']) && $_POST['lang'] || isset($this->_iaCore->requestPath[1]) && array_key_exists($this->_iaCore->requestPath[1], $this->_iaCore->languages)) {
$this->_downloadLanguage($iaView);
}
break;
case 'comparison':
$pageCaption = iaLanguage::get('languages_comparison');
$this->_compareLanguages($iaView);
break;
case 'rm':
// TODO: set checkAccess
$this->_removeLanguage($iaView);
iaUtil::go_to($this->getPath());
break;
case 'default':
$this->_setLanguageAsDefault($iaView);
iaUtil::go_to($this->getPath());
break;
case 'import':
$result = $this->_importLanguage($iaView);
iaUtil::go_to($this->getPath() . ($result ? '' : 'download/'));
break;
}
if (isset($pageCaption)) {
iaBreadcrumb::toEnd($pageCaption, IA_SELF);
$iaView->title($pageCaption);
}
}
开发者ID:kamilklkn,项目名称:subrion,代码行数:43,代码来源:languages.php
示例12: _consistencyPage
private function _consistencyPage(&$iaView)
{
if (!empty($_GET['type'])) {
if (in_array($_GET['type'], array('optimize', 'repair'))) {
$tables = $this->getHelper()->getTables();
$type = $_GET['type'];
$query = strtoupper($type) . ' TABLE ';
foreach ($tables as $tableName) {
$query .= '`' . $tableName . '`,';
}
$query = rtrim($query, ',');
$this->_iaDb->query($query);
$iaView->setMessages(iaLanguage::get($type . '_complete'), iaView::SUCCESS);
iaUtil::reload();
} else {
$this->_iaCore->startHook('phpAdminDatabaseConsistencyType', array('type' => $_GET['type']));
}
}
}
开发者ID:kamilklkn,项目名称:subrion,代码行数:19,代码来源:database.php
示例13: _createJsFile
protected function _createJsFile($file, $type = 'config')
{
$this->iaCore->factory('util');
// required in order the class iaUtil to be loaded
$iaDb =& $this->iaCore->iaDb;
switch ($type) {
case 'lang':
case 'admin_lang':
// get phrases
$stmt = "`code` = :lang AND `category` NOT IN ('tooltip', 'page', :category)";
$iaDb->bind($stmt, array('lang' => $this->iaCore->iaView->language, 'category' => $type == 'admin_lang' ? 'frontend' : iaCore::ADMIN));
$phrases = $iaDb->keyvalue(array('key', 'value'), $stmt, iaLanguage::getTable());
// get list of languages
$languagesList = $iaDb->assoc(array('code', 'title', 'direction', 'flagicon', 'iso' => 'code'), 'admin_lang' == $type ? null : "`status` = 'active'", 'languages');
$fileContent = 'intelli.' . ('admin_lang' == $type ? 'admin.' : '') . 'lang = ' . iaUtil::jsonEncode($phrases) . ';' . 'intelli.languages = ' . iaUtil::jsonEncode($languagesList) . ';';
break;
case 'config':
$stmt = "`private` = 0 && `type` != 'divider' && `config_group` != 'email_templates'";
$config = $iaDb->keyvalue(array('name', 'value'), $stmt, iaCore::getConfigTable());
if (file_exists(IA_INCLUDES . 'custom.inc.php')) {
include IA_INCLUDES . 'custom.inc.php';
}
$config['ia_url'] = IA_CLEAR_URL;
$config['packages'] = $this->iaCore->setPackagesData();
$config['items'] = array();
$config['extras'] = array(array('core', iaLanguage::get('core', 'Core')));
$array = $iaDb->all(array('name', 'title'), "`status` = 'active' ORDER BY `type`", null, null, 'extras');
foreach ($array as $item) {
$config['extras'][] = array($item['name'], $item['title']);
}
$array = $iaDb->onefield('`item`', "`item` != 'transactions'", null, null, 'items');
foreach ($array as $item) {
$config['items'][] = array($item, iaLanguage::get($item, $item));
}
$fileContent = 'intelli.config = ' . iaUtil::jsonEncode($config) . ';';
}
if (isset($fileContent)) {
if ($fh = fopen($file, 'w')) {
fwrite($fh, $fileContent);
fclose($fh);
}
}
}
开发者ID:rentpad,项目名称:subrion,代码行数:43,代码来源:ia.core.cache.php
示例14: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$entry['item'] = in_array($data['item'], $this->_items) ? $data['item'] : null;
if (!$entry['item']) {
$this->addMessage('incorrect_item');
}
if ($entry['item'] == iaUsers::getItemName()) {
if (isset($data['usergroup'])) {
$entry['usergroup'] = (int) $data['usergroup'];
}
}
if (isset($this->_fields[$entry['item']])) {
$entry['data'] = array();
if (!empty($data['fields']) && !$this->getMessages()) {
$f = $this->_fields[$entry['item']];
$array = array();
foreach ($data['fields'] as $field) {
if (in_array($field, $f[0])) {
$entry['data']['fields'][] = $field;
$array[] = $field;
} elseif (in_array($field, $f[1])) {
$entry['data']['fields'][] = $field;
}
}
if ($array) {
$this->_iaDb->update(array('for_plan' => 1), "`name` IN ('" . implode("','", $entry['data']['fields']) . "')", null, iaField::getTable());
}
}
$entry['data'] = serialize($entry['data']);
}
$this->_iaCore->startHook('phpAdminAddPlanValidation');
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
$lang = array('title' => $data['title'], 'description' => $data['description']);
foreach ($this->_iaCore->languages as $code => $language) {
if (isset($lang['title'][$code])) {
if (empty($lang['title'][$code])) {
$this->addMessage(iaLanguage::getf('error_lang_title', array('lang' => $language['title'])), false);
} elseif (!utf8_is_valid($lang['title'][$code])) {
$lang['title'][$code] = utf8_bad_replace($lang['title'][$code]);
}
}
if (isset($lang['description'][$code])) {
if (empty($lang['description'][$code])) {
$this->addMessage(iaLanguage::getf('error_lang_description', array('lang' => $language['title'])), false);
} elseif (!utf8_is_valid($lang['description'][$code])) {
$lang['description'][$code] = utf8_bad_replace($lang['description'][$code]);
}
}
}
$this->_languages = $lang;
$entry['duration'] = isset($data['duration']) ? $data['duration'] : 0;
if (!is_numeric($entry['duration'])) {
$this->addMessage('error_plan_duration');
}
$entry['cost'] = (double) $data['cost'];
$entry['cycles'] = (int) $data['cycles'];
$entry['unit'] = $data['unit'];
$entry['status'] = $data['status'];
$entry['recurring'] = (int) $data['recurring'];
$entry['expiration_status'] = $data['expiration_status'];
$this->_iaCore->startHook('phpAdminPlanCommonFieldFilled', array('item' => &$entry));
$entry['cost'] || ($this->_phraseAddSuccess = 'free_plan_added');
return !$this->getMessages();
}
开发者ID:kamilklkn,项目名称:subrion,代码行数:64,代码来源:plans.php
示例15: jsonp
public function jsonp($data)
{
$this->iaCore->factory('util');
echo sprintf('%s(%s)', isset($_GET['fn']) ? $_GET['fn'] : '', iaUtil::jsonEncode($data));
exit;
}
开发者ID:UzielSilva,项目名称:subrion,代码行数:6,代码来源:ia.core.view.php
示例16: _parseTreeNodes
protected function _parseTreeNodes($packedNodes)
{
$result = array();
$nodes = iaUtil::jsonDecode($packedNodes);
$indent = array();
foreach ($nodes as $node) {
$id = $node['id'];
$parent = $node['parent'];
$indent[$id] = 0;
'#' != $parent && ++$indent[$id] && (isset($indent[$parent]) ? $indent[$id] += $indent[$parent] : ($indent[$parent] = 0));
}
foreach ($nodes as $node) {
$result[$node['id']] = str_repeat(' ', $indent[$node['id']]) . ' — ' . $node['text'];
}
return $result;
}
开发者ID:rentpad,项目名称:subrion,代码行数:16,代码来源:ia.front.search.php
示例17: elseif
if ($url = $iaPlan->prePayment($iaUsers->getItemName(), $itemData, $plan['id'])) {
iaUtil::redirect(iaLanguage::get('thanks'), iaLanguage::get('member_created'), $url);
}
}
}
}
} elseif ('register_confirm' == $iaView->name()) {
if (!isset($_GET['email']) || !isset($_GET['key'])) {
return iaView::accessDenied();
}
$error = true;
if ($iaUsers->confirmation($_GET['email'], $_GET['key'])) {
$messages[] = $iaCore->get('members_autoapproval') ? iaLanguage::get('reg_confirmed') : iaLanguage::get('reg_confirm_adm_approve');
$error = false;
$url = $iaCore->get('members_autoapproval') ? IA_URL . 'login/' : IA_URL;
iaUtil::redirect(iaLanguage::get('reg_confirmation'), $messages, $url);
} else {
$messages[] = iaLanguage::get('confirmation_key_incorrect');
}
$iaView->assign('success', !$error);
}
}
switch ($iaView->name()) {
case 'member_password_forgot':
$template = 'forgot';
break;
case 'register_confirm':
$template = 'registration-confirmation';
break;
default:
if ($memberId) {
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:31,代码来源:registration.php
示例18: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$this->_iaCore->startHook('adminAddMemberValidation');
$iaAcl = $this->_iaCore->factory('acl');
$iaField = $this->_iaCore->factory('field');
$fields = iaField::getAcoFieldsList(iaCore::ADMIN, $this->_itemName);
// below is the hacky way to force the script to upload files to the appropriate user's folder
// FIXME
$activeUser = iaUsers::getIdentity(true);
$_SESSION[iaUsers::SESSION_KEY] = array('id' => $this->getEntryId(), 'username' => $data['username']);
list($entry, $error, $this->_messages, ) = $iaField->parsePost($fields, $entry);
$_SESSION[iaUsers::SESSION_KEY] = $activeUser;
//
if ($iaAcl->isAccessible($this->getName(), 'usergroup')) {
if (isset($data['usergroup_id'])) {
$entry['usergroup_id'] = array_key_exists($data['usergroup_id'], $this->_userGroups) ? $data['usergroup_id'] : iaUsers::MEMBERSHIP_REGULAR;
}
} elseif (iaCore::ACTION_ADD == $action) {
$entry['usergroup_id'] = iaUsers::MEMBERSHIP_REGULAR;
}
if ($error) {
return false;
}
$stmt = '`email` = :email';
if (iaCore::ACTION_EDIT == $action) {
if (isset($entry['status']) && $entry['status'] == $this->_iaDb->one('status', iaDb::convertIds((int) $this->getEntryId()))) {
unset($entry['status']);
}
$stmt .= ' AND `id` != ' . (int) $this->getEntryId();
}
if ($this->_iaDb->exists($stmt, $entry)) {
$this->addMessage('error_duplicate_email');
}
if ($this->_iaDb->exists('`username` = :username AND `id` != :id', array('username' => $entry['username'], 'id' => $this->getEntryId()))) {
$this->addMessage('username_already_taken');
}
if ($iaAcl->checkAccess($this->getName(), 'password') || iaCore::ACTION_ADD == $action) {
$this->_password = trim($data['_password']);
if ($this->_password || !empty($data['_password2'])) {
$entry['password'] = $this->getHelper()->encodePassword($this->_password);
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
if (empty($entry['password'])) {
$this->addMessage('error_password_empty');
} elseif (!utf8_is_ascii($entry['password'])) {
$this->addMessage(iaLanguage::get('password') . ': ' . iaLanguage::get('ascii_required'));
} elseif ($entry['password'] != $this->getHelper()->encodePassword($data['_password2'])) {
$this->addMessage('error_password_match');
}
}
}
if (empty($data['_password']) && iaCore::ACTION_ADD == $action) {
$this->addMessage('error_password_empty');
}
return !$this->getMessages();
}
开发者ID:nicefirework,项目名称:subrion,代码行数:55,代码来源:members.php
示例19: _processQueries
protected function _processQueries(array $entries)
{
$iaDb =& $this->iaDb;
$iaDbControl = $this->iaCore->factory('dbcontrol', iaCore::ADMIN);
require_once IA_INCLUDES . 'utils' . IA_DS . 'pclzip.lib.php';
$mysqlOptions = 'ENGINE=MyISAM DEFAULT CHARSET=utf8';
$pathsMap = array(self::TYPE_PLUGIN => IA_PLUGINS, self::TYPE_PACKAGE => IA_PACKAGES);
$path = isset($pathsMap[$this->itemData['type']]) ? $pathsMap[$this->itemData['type']] : IA_HOME;
$versionInstalled = $iaDb->one_bind('version', '`name` = :name', array('name' => $this->itemData['name']), self::getTable());
foreach ($entries as $version => $entry) {
if ($versionInstalled && version_compare($versionInstalled, $version, '>')) {
continue;
}
foreach ($entry as $data) {
if ($data['external']) {
$filePath = str_replace(array('{DIRECTORY_SEPARATOR}', '{DS}'), IA_DS, $data['query']);
$fileFullPath = $path . $this->itemData['name'] . IA_DS . $filePath;
if (iaUtil::isZip($fileFullPath)) {
$archive = new PclZip($fileFullPath);
$files = $archive->extract(PCLZIP_OPT_PATH, IA_TMP);
if (0 == $files) {
continue;
}
foreach ($files as $file) {
$iaDbControl->splitSQL($file['filename']);
iaUtil::deleteFile($file['filename']);
}
} else {
$iaDbControl->splitSQL($fileFullPath);
}
} else {
if ($data['query']) {
$iaDb->query(str_replace(array('{prefix}', '{mysql_version}'), array($iaDb->prefix, $mysqlOptions), $data['query']));
}
}
}
}
}
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:38,代码来源:ia.admin.extra.php
示例20: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
parent::_preSaveEntry($entry, $data, $action);
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad', 'utf8_to_ascii');
if (!utf8_is_valid($entry['title'])) {
$entry['title'] = utf8_bad_replace($entry['title']);
}
if (empty($entry['title'])) {
$this->addMessage('title_is_empty');
}
if (!utf8_is_valid($entry['body'])) {
$entry['body'] = utf8_bad_replace($entry['body']);
}
if (empty($entry['body'])) {
$this->addMessage('body_is_empty');
}
if (empty($entry['date_added'])) {
$entry['date_added'] = date(iaDb::DATETIME_FORMAT);
}
$entry['alias'] = $this->getHelper()->titleAlias(empty($entry['alias']) ? $entry['title'] : $entry['alias']);
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) {
$this->_iaCore->loadClass(iaCore::CORE, 'picture');
$iaImage = $this->_iaCore->factoryPlugin($this->getPluginName(), iaCore::ADMIN, 'image');
$imageData = json_decode($entry['image-data'], true);
$path = iaUtil::getAccountDir();
$file = $_FILES['image'];
$token = iaUtil::generateToken();
$info = array('image_width' => $this->_iaCore->get('portfolio_image_width'), 'image_height' => $this->_iaCore->get('portfolio_image_height'), 'crop_width' => $imageData['width'], 'crop_height' => $imageData['height'], 'thumb_width' => $this->_iaCore->get('portfolio_thumbnail_width'), 'thumb_height' => $this->_iaCore->get('portfolio_thumbnail_height'), 'positionX' => $imageData['x'], 'positionY' => $imageData['y'], 'position' => 'LT', 'resize' => 'after_crop', 'resize_mode' => iaImage::CROP);
if ($image = $iaImage->processFolioImage($file, $path, $token, $info)) {
if ($entry['image']) {
$iaImage = $this->_iaCore->factory('picture');
$iaImage->delete($entry['image']);
}
$entry['image'] = $image;
}
}
if (empty($entry['image'])) {
$this->addMessage('invalid_image_file');
}
if ($this->getMessages()) {
return false;
}
unset($entry['image-src']);
unset($entry['image-data']);
return true;
}
开发者ID:NIXAP,项目名称:subrion-plugin-portfolio,代码行数:46,代码来源:index.php
注:本文中的iaUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论