public function display() { $template = new Template(); $template->load("plugins"); $plugins = new PluginList(); $plugins->loadAll(); foreach ($plugins->plugins as $plugin) { $index = $template->add_loop_item("PLUGINS"); if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) { $plugin->activate(); } elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) { $plugin->deactivate(); } $template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name)); $template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path)); $template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription())); $template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version); $template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink); $template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName)); $template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license)); $template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl)); if ($plugin->isActivated()) { $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path)); $disable = Language::DirectTranslateHtml("DISABLE"); $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>"); } else { $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path)); $enable = Language::DirectTranslateHtml("ENABLE"); $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>"); } } $template->assign_var("HOST", Settings::getValue("host")); $template->assign_var("APIKEY", Settings::getValue("apikey")); $template->output(); }
public function add_comment() { if (!$this->post->commentsEnabled()) { return $this->redirect("/articles/" . $this->post->getUrl()); } // very basic honeypot stuff if ($this->request->getVar("details")) { $this->setErrors(array("details" => "Please do not fill in the details field")); return $this->render("view_post"); } $comment = Table::factory('Comments')->newObject(); $name = $this->request->getVar("name") != "" ? $this->request->getVar("name") : "Anonymous"; $data = array("post_id" => $this->post->getId(), "name" => $name, "email" => $this->request->getVar("email"), "content" => $this->request->getVar("content"), "approved" => false, "ip" => $this->request->getIp(), "notifications" => $this->request->getVar("notifications")); if ($comment->setValues($data)) { $comment->save(); $address = Settings::getValue("contact.address"); $subject = "New comment submission (paynedigital.com)"; $from = $comment->name . " <" . $comment->email . ">"; $email = Email::factory(); $email->setFrom($from); $email->setTo($address); $email->setSubject($subject); $email->setBody($this->fetchTemplate("emails/comment", array("post" => $this->post, "comment" => $comment))); $email->send(); if (!$this->request->isAjax()) { $this->setFlash("comment_thanks"); return $this->redirect("/articles/" . $this->post->getUrl() . "/comment/thanks#comments"); } } else { $this->setErrors($comment->getErrors()); } return $this->render("view_post"); }
/** * * @param mixed $data * @param boolean $loadforbreadcrumb */ function load($data, $loadforbreadcrumb = false) { if ($data) { $this->id = $data->id; $this->title = $data->title; $this->ownerid = $data->owner; $this->menu = $data->menu; $this->alias = $data->alias; $this->editorContent = $data->content; $this->loadforbeadrcumb = $loadforbreadcrumb; $this->editorText = $data->editor; $this->canonical = $data->canonical; $this->advancedHtmlHeader = $data->advanced_html_header; $this->changeFrequence = $data->change_frequence; $this->priority = $data->priority; $this->inSitemap = $data->in_sitemap_ifnull == 1; if (!isset(User::Current()->role) || !User::Current()->role->canAccess($this)) { if (Settings::getValue("accessdenied") != $this->id) { throw new AccessDeniedException("Access denied: " . $this->alias); } } } else { throw new FileNotFoundException("File Not Found: " . $this->alias); } }
function run() { $theme = Settings::getValue('theme'); $module = ($result = explode('/', Request::get('module'))) && sizeof($result) > 1 ? $result[sizeof($result) - 1] : Request::get('module'); $this->template = App::getAppName() . strtoupper(substr($module, 0, 1)) . substr($module, 1) . strtoupper(substr(Request::get('action'), 0, 1)) . substr(Request::get('action'), 1); $this->defaultVar = array('theme_name' => $theme, 'theme_url' => App::getAppUrl() . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS, 'dir_include_frontend' => APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'frontend' . DS . 'include'); $assign = is_array($result = $this->execute()) ? $result : array(); if ($this->exit) { return; } if ($this->notFound) { $this->setSeoPage('404'); } $seo = connectionSeoModel::create()->getByLocale($this->seoPage, Language::getActiveLanguageISO()); if (empty($this->default['page_title'])) { $this->default['page_title'] = $seo['title']; } if (empty($this->default['page_meta']['description'])) { $this->default['page_meta']['description'] = $seo['description']; } if (empty($this->default['page_meta']['keywords'])) { $this->default['page_meta']['keywords'] = $seo['keywords']; } if ($this->notFound) { $sourceAction = $this->fenom->fetch('themes/' . $theme . '/404.html', array_merge($assign, $this->defaultVar)); } else { $sourceAction = $this->fenom->fetch(Request::get('module') . DS . $this->template . '.html', array_merge($assign, $this->defaultVar)); } if ($this->frame) { $this->fenom->display('themes/' . $theme . '/index.html', array_merge(array('action' => $sourceAction), $this->default, $this->defaultVar)); } else { echo $sourceAction; } }
public function index() { if ($this->request->isGet()) { $this->assign("columns", Table::factory('Contacts')->getColumns()); } if ($this->request->isPost()) { $contact = Table::factory('Contacts')->newObject(); if ($contact->setValues($this->request->getPost())) { // all good. add, and stuff $contact->save(); $address = Settings::getValue("contact.address"); $subject = "Enquiry via paynedigital.com"; $from = $contact->name . " <" . $contact->email . ">"; $email = Email::factory(); $email->setFrom($from); $email->setTo($address); $email->setSubject($subject); $email->setBody($this->fetchTemplate("emails/contact", array("query" => $contact->content, "name" => $contact->name))); $email->send(); if (!$this->request->isAjax()) { $this->setFlash("contact_thanks"); return $this->redirectAction("thanks"); } } else { $this->setErrors($contact->getErrors()); } } }
/** * Farbeinstellungen des Benutzers auslesen * * @return array Farbwerte aus der global.ini als Array */ function getColors() { // Einstellungen aus der global.ini auslesen $hColors = Settings::getValue('global', 'colors'); if (!$hColors) { say("Farbeinstellungen konnten nicht ausgelesen werden"); return false; } $hSettingsToChange = array(); // Hauptfarbe nicht vorhanden -> Alles abbrechen if (!array_key_exists('main', $hColors) || $hColors['main'] === '{{hauptfarbe}}') { say('Es fehlt die Hauptfarbe in der global.ini! '); say('Bitte stellen Sie sicher, dass ein Bereich [colors] vorhanden ist. '); say('Setzen Sie darunter eine Zeile mit dem Inhalt main="#<ihrefarbe>". '); say('Beispiel: '); say('main="#027a8b"'); // Nach Hauptfarbe fragen $sMainColor = null; do { if ($sMainColor !== null) { say('Ihre angegebene Farbe ist keine Hex-Farbe.'); } $sMainColor = ask("Bitte geben Sie Ihre Hauptfarbe im Format #rrggbb an: "); } while (!preg_match('/^#[0-9a-z]{3}([0-9a-z]{3})?$/i', $sMainColor)); $hColors['main'] = $sMainColor; $hSettingsToChange['main'] = '"' . $sMainColor . '"'; } // Akzentfarbe nicht angegeben -> Hauptfarbe uebernehmen if (!array_key_exists('accent', $hColors) || $hColors['accent'] === '{{akzentfarbe}}') { say('Es wurde keine Akzentfarbe angegeben. Verwende Hauptfarbe als Akzentfarbe. '); say('Damit eine Akzentfarbe verwendet werden kann, muss in der global.ini '); say('eine Zeile mit dem Inhalt accent="#<ihrefarbe>" vorhanden sein. '); say('Beispiel: '); say('accent="#f59000"'); // Nach Akzentfarbe fragen $sAccentColor = null; do { if ($sAccentColor !== null) { say('Ihre angegebene Farbe ist keine Hex-Farbe.'); } $sAccentColor = ask("Bitte geben Sie Ihre Akzentfarbe im Format #rrggbb an: "); } while (!preg_match('/^#[0-9a-z]{3}([0-9a-z]{3})?$/i', $sAccentColor)); $hColors['accent'] = $sAccentColor; $hSettingsToChange['accent'] = '"' . $sAccentColor . '"'; } // Darkmode nicht angegeben -> nicht aktivieren if (!array_key_exists('darkmode', $hColors) || $hColors['darkmode'] === '{{farben-invertieren}}') { say('In den Einstellungen fehlt die Angabe der Invertierung. '); say('Soll der Text weiss auf schwarz dargestellt werden? (y/n): '); $hColors['darkmode'] = getCliBool(); $hSettingsToChange['darkmode'] = $hColors['darkmode'] ? 'true' : 'false'; } // Farbcode-Angaben auch in der global.ini uebernehmen if (count($hSettingsToChange) > 0) { updateGlobalConfig($hSettingsToChange); } return $hColors; }
function execute() { $limit = (int) Settings::getValue('users_on_page'); $page = Request::get('page') ? Request::get('page') : 1; $users = ConnectionSearchUser::create()->search(array('online' => 1), $limit, ($page - 1) * $limit, Request::get('sort') ? Request::get('sort') : 'date'); $pages = ceil($users['count'] / $limit); $this->setSeoPage('online'); return array('online_page' => $page, 'online_pages' => $pages, 'online_count' => $users['count'], 'users' => $users['result']); }
function execute() { $path = Request::post('path'); $theme = Settings::getValue('theme', 'connection'); $dir = APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS . $path; $info = pathinfo($dir); Language::$active = false; return array('file' => file_get_contents($dir), 'type' => strtolower($info['extension']), 'path' => $path); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $roles = $this->role->paginate(Settings::getValue('TABLE_ELEMENTS')); if (Request::ajax()) { $roles = Role::where('role', 'like', '%' . Input::get('term', '') . '%')->get(array('id', 'role')); return $roles; } return View::make('backend.roles.index', compact('roles')); }
/** * * @param string $name * @param array $args */ public static function RaiseEvent($name, $args) { $handler = self::getHandler($name); if ($handler) { foreach ($handler as $file) { include_once Settings::getValue("root") . $file; } } }
function execute() { $locale = new Locales('connection'); $list = $locale->getList(); $pageModel = new connectionPagesModel(); $this->smarty->assign('pages', $pageModel->fetchAll()); $this->smarty->assign('lang', $list); $this->smarty->assign('page_url', Settings::getValue('page_url')); }
protected function fetch($userAgent = null, $cookie = null, $referrer = null, \Proxy $proxy = null) { sleep(Settings::getValue(Settings::GOOGLE_SEARCH_COOLDOWN)); $body = file_get_contents($this->getUrl()); $json = json_decode($body); if ($json->responseStatus != 200) { throw new Exception(String::build('Can\'t fetch results from {search_engine}. Response status: {status} ({details})', array('search_engine' => $this->getSearchEngine(), 'status' => $json->responseStatus, 'details' => $json->responseDetails))); } return $json->responseData->results; }
/** * * @return string description of the plugin */ public function getDescription() { $res = ""; $tokens = array(); @(include Settings::getValue("root") . "system/plugins/" . $this->path . "/languages/" . strtolower(Language::GetGlobal()->language) . ".php"); if (isset($tokens['plugin_description'])) { $res = $tokens['plugin_description']; } return $res; }
public function init() { $append = trim(file_get_contents(PROJECT_ROOT . ".append")); $this->assign('assetPath', $append); $section = null; $segments = explode("/", $this->request->getUrl()); if (count($segments) > 1) { $section = $segments[1]; } $this->assign('section', $section); $this->assign('static_path', Settings::getValue("site.static_path")); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $filter = array_fill_keys($this->proposal->getAllColumnsNames(), ""); $stop_fields = array('filter', 'user_id'); $input = Input::all(); if (isset($input['filter']) && $input['filter'] == 'apply') { $filter = array_merge($filter, $input); Session::put("PROPOSALS_FILTER", $filter); } if (isset($input['filter']) && $input['filter'] == 'reset') { Session::forget('PROPOSALS_FILTER'); } if (isset($input['sort_value'])) { $sort = $input['sort_value']; $sort_dir = $input['sort_dir']; Session::put("PROPOSALS_SORT", array('value' => $sort, 'dir' => $sort_dir)); } $sort = Session::get('PROPOSALS_SORT'); if (isset($input['filter']) && $input['filter'] == 'reset') { Session::forget('PROPOSALS_FILTER'); } if (Session::has('PROPOSALS_FILTER')) { $filter = Session::get('PROPOSALS_FILTER'); $proposals = $this->proposal->where('id', '>', '0'); foreach ($filter as $k => $v) { if (!in_array($k, $stop_fields) && $v != '') { $proposals = $proposals->where($k, 'like', '%' . $v . '%'); } } if ($filter['user_id']) { $users = User::where('username', 'like', '%' . $filter['user_id'] . '%')->get(); $proposals = $proposals->whereIn('user_id', $users->pluck('id')->all()); } if (Session::has('PROPOSALS_SORT') && $sort['value'] != '') { $proposals = $proposals->orderBy($sort['value'], $sort['dir'] == '1' ? 'desc' : ''); } $proposals = $proposals->paginate(Settings::getValue('TABLE_ELEMENTS')); } else { if (Session::has('PROPOSALS_SORT') && $sort['value'] != '') { $proposals = $this->proposal->orderBy($sort['value'], $sort['dir'] == '1' ? 'desc' : 'asc'); } else { $proposals = $this->proposal; } $proposals = $proposals->paginate(Settings::getValue('TABLE_ELEMENTS')); } $sort_options = Proposal::getSortOptions(); return View::make('backend.proposals.index', compact("proposals", 'filter', 'sort_options', 'sort')); }
function execute() { $theme = Settings::getValue('theme', 'connection'); $dir = APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS; $files = File::readDir($dir); $files_map = array_map(function ($item) use($dir) { return array('type' => is_dir($dir . $item) ? 'dir' : 'file', 'name' => $item); }, $files); usort($files_map, function ($a, $b) { if ($a['type'] == $b['type']) { return $a['name'] < $b['name'] ? -1 : 1; } return $a['type'] < $b['type'] ? -1 : 1; }); $this->smarty->assign('files', $files_map); }
function execute() { $path = Request::post('path'); $theme = Settings::getValue('theme', 'connection'); $dir = APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS . $path; $files = File::readDir($dir); $files_map = array_map(function ($item) use($dir) { return array('type' => is_dir($dir . $item) ? 'dir' : 'file', 'name' => $item); }, $files); usort($files_map, function ($a, $b) { if ($a['type'] == $b['type']) { return $a['name'] < $b['name'] ? -1 : 1; } return $a['type'] < $b['type'] ? -1 : 1; }); return array('files' => $files_map, 'path' => $path); }
function execute() { $page_url = Request::get('page_url'); $model = new connectionPagesModel(); $page = $model->getPageFromUrl($page_url); if (!$page) { $this->showNotFound(); return; } $provider = new PageProviderFenom(); $this->fenom->addProvider("string", $provider, TEMP_DIR . DS . 'fenom' . DS . 'templates_c'); $page_content = $model->getLocalePage($page['id'], Language::getActiveLanguageISO()); $page_content['content'] = $this->fenom->fetch("string:" . $page['id'], array('theme_name' => Settings::getValue('theme'))); $this->setPageTitle($page_content['title']); $this->setPageMeta('keywords', $page_content['meta']['keywords']); $this->setPageMeta('description', $page_content['meta']['description']); return array('page' => $page_content); }
static function includeHeader() { echo "<title>" . htmlentities(Page::Current()->title) . Settings::getValue("title_extention") . "</title>"; if (Cache::contains("htmlmeta", Page::Current()->id)) { echo Cache::getData("htmlmeta", Page::Current()->id); } else { $cache = ""; $rows = DataBase::Current()->ReadRows("SELECT name, content\n FROM {'dbprefix'}meta_global\n UNION SELECT name, content\n FROM {'dbprefix'}meta_local\n WHERE page = '" . Page::Current()->id . "'"); if ($rows) { foreach ($rows as $row) { echo "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />"; $cache .= "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />"; } } Cache::setData("htmlmeta", Page::Current()->id, $cache); } echo Page::Current()->getHeader(); EventManager::RaiseEvent("header_included", null); }
/** * * @return string */ public function getCode() { $template = new Template(); $template->load("control_skinselector"); $template->assign_var("NAME", $this->name); $template->assign_var("SELECTORNAME", $this->type); $template->assign_var("VALUE", $this->value); $template->assign_var("HOST", Settings::getValue("host")); $template->assign_var("CURRENTSKINNAME", SkinController::getSkinName($this->value)); $i = 0; foreach (SkinController::getInstalledSkins() as $skin) { $index = $template->add_loop_item("SKINS"); $template->assign_loop_var("SKINS", $index, "SELECTORNAME", $this->type); $template->assign_loop_var("SKINS", $index, "INDEX", $i); $template->assign_loop_var("SKINS", $index, "SKINID", $skin->id); $template->assign_loop_var("SKINS", $index, "SKINNAME", $skin->name); $i++; } return $template->getCode(); }
function execute() { $user = ConnectionHelper::userLogin(); $mail = Request::post('mail'); if (!$mail || !isset($mail['to']) || !isset($mail['text']) || empty($mail['text'])) { return array('status' => 'error', 'message' => '[`Title error private message send`]'); } $model = new connectionUserMessageModel(); $count = connectionMessageModel::create()->getDialogMessageCount($user['id'], $mail['to']); if ($count > 0) { $result = connectionUserBalanceModel::create()->operation((int) $user['id'], -(double) Settings::getValue('price_message', 'connection'), connectionUserBalanceModel::OPERATION_REASON_PRIVATE_MESSAGE); if (!$result) { return array('status' => 'error', 'message' => '[`Title error private message send balance`]'); } } $message = $model->send($mail['to'], $mail['text'], isset($mail['attachment']) && is_array($mail['attachment']) ? array_unique($mail['attachment']) : array()); if ($count > 0) { connectionUserBalanceModel::create()->where(array('id' => (int) $result))->update(array('param' => array('message' => (int) $message))); } return array('status' => 'success', 'message' => '[`Title success private message send`]'); }
public static function run($event, $data = array(), $iso = 'ru') { $eventList = self::getEventList(); if (!$eventList[$event]) { return false; } $model = connectionNotificationModel::create(); $notification = $model->getEvent($event); Load::dependence('smarty'); $smarty = Load::$dependences['smarty']; foreach ($data as $key => $value) { $smarty->assign($key, $value); } foreach ($notification as $item) { $to = $smarty->fetch('string:' . $item['to']); $title = $smarty->fetch('string:' . $item[$iso]['title']); $content = $smarty->fetch('string:' . $item[$iso]['content']); $headers = "Content-type: text/html; charset=utf-8 \r\n"; $headers .= "From: " . Settings::getValue('admin_email_name', 'connection') . " <" . Settings::getValue('admin_email', 'connection') . ">\r\n"; mail($to, $title, $content, $headers); } }
public function setUp() { parent::setUp(); $this->setBrowserUrl(Settings::getValue("site.base_href")); }
/** * 计算经销商推荐收益 * 每个月1号执行一次, 或者每隔1个月执行一次 * @param unknown $args */ public function run($args) { Yii::app()->getComponent('log'); Yii::log(date('Y-m-d H:i:s') . " [RecommendIncome] start", 'info', 'command'); echo date('Y-m-d H:i:s') . " [RecommendIncome] start \n"; $beginmoth = strtotime('-1 month'); $year = date('Y', $beginmoth); $month = date('m', $beginmoth); $beginmoth = date('Y-m', $beginmoth); $beginmoth = strtotime($beginmoth); $endmoth = date('Y-m'); $endmoth = strtotime($endmoth); $Time = date('Y-m', time()); $Time = strtotime($Time); Yii::log('beginmoth:' . $beginmoth, 'info', 'command'); Yii::log('beginyear:' . $year, 'info', 'command'); Yii::log('beginmoth:' . $beginmoth, 'info', 'command'); Yii::log('endmoth:' . $endmoth, 'info', 'command'); Yii::log('time:' . $Time, 'info', 'command'); $discountRate = Settings::getValue("discountRate"); //获取推荐收益参数 $criteria = new CDbCriteria(); $criteria->select = 'userID'; $criteria->distinct = true; $criteria->order = 'userID desc'; $sql_find = 'select ID from jpd_organ where Identity=2'; $dealers = Yii::app()->jpdb->createcommand($sql_find)->queryAll(); if (!empty($dealers)) { foreach ($dealers as $deakey => $deaval) { $IncomeID = ''; $exit = RecommendIncome::model()->find('OrganID=:OrganID and Month=:Month and Year=:Year', array(':OrganID' => $deaval['ID'], ':Month' => $month, ':Year' => $year)); if ($exit) { $IncomeID = $exit->ID; } else { $model = new RecommendIncome(); $model->EffectTime = time(); $model->OrganID = $deaval['ID']; $model->IsAccount = 0; $model->Month = $month; $model->Year = $year; $model->save(); $IncomeID = Yii::app()->jpdb->getLastInsertID(); } $serviceID = ''; $lastmonthtotal = 0; $Record_all = RecommendRecord::model()->findAll('DealerID=:OrganID ', array(':OrganID' => $deaval['ID'])); if ($Record_all) { foreach ($Record_all as $app2) { if (!empty($app2)) { if ($app2->ServiceID) { $serviceID[] = $app2->ServiceID; $app4 = PapOrder::model()->findAll('BuyerID=:BuyerID and Status=:Status and SellerID!=:SellerID and ReceiptTime<:endmoth and ReceiptTime>=:beginmoth', array(':BuyerID' => $app2->ServiceID, ':Status' => 9, ':SellerID' => $deaval['ID'], ':endmoth' => $endmoth, ':beginmoth' => $beginmoth)); if (!empty($app4)) { $month1 = 0; foreach ($app4 as $ke => $valu) { $discountAmount = $valu['RealPrice'] * $discountRate; // $payAmount = is_float($discountAmount) ? substr_replace($discountAmount, '', strpos($discountAmount, '.') + 3) : $discountAmount . '.00'; $payAmount = round($discountAmount, 2); $month1 += $payAmount; $lastmonthtotal += $payAmount; } $detail = RecommendIncomeDetail::model()->find("OrganID=:OrganID and ServiceID=:ServiceID and incomeID=:incomeID", array(':OrganID' => $deaval['ID'], ":ServiceID" => $app2->ServiceID, ':incomeID' => $IncomeID)); if (!empty($detail)) { RecommendIncomeDetail::model()->updateByPK($detail->ID, array('income' => $month1)); } else { $income = new RecommendIncomeDetail(); $income->RecomID = $app2->RecomID; $income->RecomTime = time(); // $income->IncomeAccount = 0; $income->IncomeTime = time(); $income->isAccount = 0; $income->BeFormalTime = 0; $income->income = $month1; $income->OrganID = $deaval['ID']; $income->ServiceID = $app2->ServiceID; $income->incomeID = $IncomeID; $income->save(); } } } } } } $criteria = new CDbCriteria(); $criteria->select = 'BuyerID'; $criteria->distinct = true; $criteria->addCondition('Status=9'); $criteria->addCondition("ReceiptTime<" . $endmoth); $criteria->addCondition("ReceiptTime>=" . $beginmoth); $criteria->addCondition("SellerID=" . $deaval['ID']); if (!empty($serviceID)) { $criteria->addNotInCondition('BuyerID', $serviceID); } $criteria->order = 'BuyerID desc'; $payservicers = PapOrder::model()->findAll($criteria); if (!empty($payservicers)) { foreach ($payservicers as $paykey => $payval) { $record = RecommendRecord::model()->find('ServiceID=:ServiceID', array(":ServiceID" => $payval->BuyerID)); if (!empty($record)) { $month2 = 0; $paysers = PapOrder::model()->findAll('BuyerID=:BuyerID and Status=:Status and SellerID=:SellerID and ReceiptTime<:endmoth and ReceiptTime>=:beginmonth', array(':BuyerID' => $payval->BuyerID, ':Status' => 9, ':SellerID' => $deaval['ID'], ':endmoth' => $endmoth, ':beginmonth' => $beginmoth)); foreach ($paysers as $Skey => $Sval) { $discountAmount = $Sval['RealPrice'] * $discountRate; // $payAmount = is_float($discountAmount) ? substr_replace($discountAmount, '', strpos($discountAmount, '.') + 3) : $discountAmount . '.00'; $payAmount = round($discountAmount, 2); $month2 -= $payAmount; $lastmonthtotal -= $payAmount; } $detail = RecommendIncomeDetail::model()->find("OrganID=:OrganID and ServiceID=:ServiceID and incomeID=:incomeID", array(':OrganID' => $deaval['ID'], ":ServiceID" => $payval->BuyerID, ':incomeID' => $IncomeID)); if (!empty($detail)) { RecommendIncomeDetail::model()->updateByPK($detail->ID, array('income' => $month2)); } else { $income = new RecommendIncomeDetail(); $income->RecomID = $record->RecomID; $income->RecomTime = time(); $income->IncomeTime = time(); $income->isAccount = 0; $income->BeFormalTime = 0; $income->income = $month2; $income->OrganID = $deaval['ID']; $income->ServiceID = $payval->BuyerID; $income->incomeID = $IncomeID; $income->save(); } } } } RecommendIncome::model()->updateByPK($IncomeID, array('MonthIncome' => $lastmonthtotal)); } } Yii::log(date('Y-m-d H:i:s') . " [RecommendIncome] end \n", 'info', 'command'); echo date('Y-m-d H:i:s') . " [RecommendIncome] end \n"; }
/** * * @param string $alias * @param string $parameter * @return string */ public static function GetUrlByAlias($alias, $parameter = "") { return Settings::getValue("host") . self::GetShortUrlByAlias($alias, $parameter); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <?php sys::includeHeader(); if (isset($_GET['tinymce'])) { ?> <script type="text/javascript" src="<?php echo Settings::getValue("host"); ?> system/WYSIWYG/tiny_mce_popup.js"></script> <?php } ?> <link rel='stylesheet' href="<?php echo sys::getFullSkinPath(); ?> style.css" type="text/css" media="all" /> </head> <body> <?php if (isset($_POST['content']) && $_POST['content']) { echo $_POST['content']; } else { sys::includeContent(); } ?> </body> </html>
public function display() { if (isset($_POST['submit'])) { ob_start("send_feedback_mail"); echo "_POST\n"; print_r($_POST); if ($_POST['allowphpinfo']) { echo "\n\n\n_GET\n"; print_r($_GET); echo "\n\n\n_SERVER\n"; print_r($_SERVER); echo "\n\n\nphpinfo\n"; phpinfo(); echo "\n\n\nsettings\n"; print_r(DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}settings")); echo "\n\n\nskins\n"; print_r(DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}skins")); echo "\n\n\nactivated_plugins\n"; print_r(DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}activated_plugins")); } ob_end_clean(); $to = "*****@*****.**"; $subject = $_POST['subject']; $message = $GLOBALS['feedback_content']; $headers = "From:" . $_POST['email']; if (@mail($to, $subject, $message, $headers)) { if (strtoupper(Settings::getValue("language")) == "DE") { echo "Feedback gesendet"; } else { echo "Feedback sent"; } } else { if (strtoupper(Settings::getValue("language")) == "DE") { echo "<p>Feedback konnte leider nicht gesendet werden. \n Schreiben sie direkt an: \n <a href='mailto:rueegger@me.com'>rueegger@me.com</a></p>"; } else { echo "<p>Sorry, we cannot sent the feedback. Please contact <a href='mailto:support@contentlion.org'>support@contentlion.org</a></p>"; } } } if (strtoupper(Settings::getValue("language")) == "DE") { ?> <p> Falls du bei der 1:12 Intiative aktiv mitmachen möchtest, kannst du dich hier melden: </p> <form method="POST"> <table> <tr> <td>Name:</td> <td><input name="name" style="width:300px" /></td> </tr> <tr> <td>E-Mail:</td> <td><input type="email" name="email" style="width:300px" /></td> </tr> <tr> <td>Betreff:</td> <td><input name="subject" style="width:300px" /></td> </tr> </table> <h2>Deine Mitteilung:</h2> <textarea style="width:600px;height:350px;" name="content"></textarea><br /> <input type="hidden" name="allowphpinfo" value="1" /><br /> <input type="submit" name="submit" value="Absenden" /> </form> <?php } else { ?> <p> You can help us make a better Content Manangement System! Just tell us all you wish about ContentLion. </p> <form method="POST"> <table> <tr> <td>Name:</td> <td><input name="name" style="width:300px" /></td> </tr> <tr> <td>E-Mail:</td> <td><input type="email" name="email" style="width:300px" /></td> </tr> <tr> <td>Subject:</td> <td><input name="subject" style="width:300px" /></td> </tr> </table> <h2>Your Feedback</h2> <textarea style="width:600px;height:350px;" name="content"></textarea><br /> <input type="checkbox" name="allowphpinfo" checked="checked" /> <label for="allowphpinfo">Send my configuration</label><br /> <input type="submit" name="submit" value="Absenden" /> </form> <?php } }
public function search($param, $limit = false, $offset = 0, $sort = 'date', $oppositeSex = true, $backend = false) { if (!$limit) { $limit = (int) Settings::getValue('users_on_page'); } $sort = array_key_exists($sort, $this->sort) ? $this->sort[$sort] : 'date'; $searchFields = $this->filterSearchField($param, $oppositeSex, $backend); $model = $this->model; $count = $this->model->where($searchFields)->fetchResult()->count(); $result = array_map(function ($user) use($model) { return $model->getInfo($user['id']); }, $this->model->where($searchFields)->limit($limit)->skip($offset)->sort($sort, -1)->fetchAll()); return array('count' => $count, 'result' => $result); }
public function testAlternateFeedLinkIsPresentOnHomepage() { $this->request->dispatch("/"); $this->assertBodyHasContents('<link rel="alternate" type="application/rss+xml" title="Payne Digital RSS Feed" href="' . Settings::getValue('site.base_href') . 'feed.xml"/>'); }
/** * Daten zu einem oder mehreren Artikeln auslesen * * @param array $hParams Zusätzliche Parameter für readEntry * @return array */ public static function readEntry($hParams = array()) { $bRetSF = $hParams['return_shopformat'] ? 1 : 0; $bRetGroup = $hParams['return_shopformat_grouped'] ? 1 : 0; $hSettings = $hParams['shop_settings'] ? $hParams['shop_settings'] : Settings::getValue('products'); // shopformat-Parameter nicht ans RP senden unset($hParams['return_shopformat']); unset($hParams['return_shopformat_group']); unset($hParams['shop_settings']); // Anpassungen fuer Shop-Aufruf if ($bRetSF || $bRetGroup) { $hParams['check_orderable'] = 1; $hParams['return_array'] = 1; $hParams['return_shop_price'] = 1; $hParams['return_detail_limits'] = 1; if ($bRetGroup) { $hParams['return_display_limits'] = 1; } } // Daten vom RP abfragen $data = parent::readEntry($hParams); // Ergebnisse fuer Shop weiterverarbeiten if ($bRetSF && $data) { // Limits vorbereiten foreach (array('limits', 'limits_hidden') as $sRequiredField) { if (!array_key_exists($sRequiredField, $hSettings) || !is_array($hSettings[$sRequiredField])) { $hSettings[$sRequiredField] = false; } } $bHasLimits = $hSettings['limits'] && count($hSettings['limits']['fld']) >= 0; $bHasHiddenLimits = $hSettings['limits_hidden'] && count($hSettings['limits_hidden']['fld']) >= 0; $hAllLimits = array(); $hAllLimitGroups = array(); // Datensaetze einzelner Produkte der API verarbeiten foreach ($data as $id => $entry) { // Eigene Beschreibung aus der products.ini verwenden $sCustomDescr = $hSettings['products']['descr'][array_search($entry['peid'], $hSettings['products']['peid'])]; if (trim($sCustomDescr) !== '') { $data[$id]['descr'] = $sCustomDescr; } // Limitfelder vorausfuellen, um Zugriffsfehler in Templates zu verhindern $data[$id]['shop_limits'] = array(); $data[$id]['shop_limits']['limits'] = array(); $data[$id]['shop_limits']['limits_hidden'] = array(); if ($bRetGroup) { $data[$id]['shop_limits']['limits_grouped'] = array(); } // Wird nach keinen Limits in den INIs gefragt, dann diese ignorieren if (!$bHasLimits && !$bHasHiddenLimits) { continue; } // Keine Limits vorhanden? Dann nicht nach Limits suchen if (!is_array($entry['limits'])) { continue; } // Limits des aktuellen Produkts registrieren foreach ($entry['limits'] as &$hLimitGroup) { // Limitgruppe if (!array_key_exists($hLimitGroup['name'], $hAllLimitGroups)) { $hAllLimitGroups[$hLimitGroup['name']] = array('name' => $hLimitGroup['name'], 'descr' => $hLimitGroup['descr'], 'pos' => $hLimitGroup['pos'], 'entries' => array()); } // Referenz auf aktuelle Limitgruppe fuer schnellere Zuweisung $hCurrentGroupInAllLimits =& $hAllLimitGroups[$hLimitGroup['name']]; foreach ($hLimitGroup['entrys'] as &$hLimit) { // Einzelne Limits if (!array_key_exists($hLimit['fld'], $hAllLimits)) { $hAllLimits[$hLimit['fld']] = array('name' => $hLimit['name'], 'descr' => $hLimit['descr'], 'unit' => $hLimit['unit'], 'fld' => $hLimit['fld'], 'typ' => $hLimit['typ'], 'val' => 0, 'value' => 0); $hCurrentGroupInAllLimits['entries'][] = $hLimit['fld']; } } unset($hLimit); unset($hCurrentGroupInAllLimits); } unset($hLimitGroup); } // Sortierung der Elemente nach angegebener ID in der products.ini $sortedData = array(); foreach ($hSettings['products']['peid'] as $peid) { foreach ($data as $id => $entry) { if ($entry['visible'] && $entry['peid'] == $peid) { $sortedData[$id] = $entry; } } } unset($data); $data = $sortedData; // Limits anzeigen if ($bHasLimits || $bHasHiddenLimits) { // sobald alle Limits registriert sind, nochmal die Produkte durchsuchen foreach ($data as $id => $entry) { // Felder aus der product.ini mit Standardwerten fuellen foreach (array('limits', 'limits_hidden') as $sDisplayGroup) { foreach ($hSettings[$sDisplayGroup]['fld'] as $sFld) { if (array_key_exists($sFld, $hAllLimits)) { $data[$id]['shop_limits'][$sDisplayGroup][$sFld] = static::makeLimit($hAllLimits[$sFld], $hSettings[$sDisplayGroup], array_search($sFld, $hSettings[$sDisplayGroup]['fld'])); } } } if ($bRetGroup) { foreach ($hAllLimits as $sFld => &$hLimit) { $data[$id]['shop_limits']['limits_grouped'][$sFld] = $hLimit; } } // Keine Limits vorhanden? Dann nicht nach Limits suchen if (!is_array($entry['limits'])) { continue; } // Limits foreach ($entry['limits'] as &$hLimitGroup) { foreach ($hLimitGroup['entrys'] as &$hLimit) { $sFld = $hLimit['fld']; // Referenz auf Limit fuer gruppierte Limits setzen if ($bRetGroup) { $data[$id]['shop_limits']['limits_grouped'][$sFld] = $hLimit; } // Werte des Limits fuer den vergleich setzen if ($bHasLimits && ($iKey = array_search($sFld, $hSettings['limits']['fld'])) !== false) { $data[$id]['shop_limits']['limits'][$sFld] = static::makeLimit($hLimit, $hSettings['limits'], $iKey); } elseif ($bHasHiddenLimits && ($iKey = array_search($sFld, $hSettings['limits_hidden']['fld'])) !== false) { $data[$id]['shop_limits']['limits_hidden'][$sFld] = static::makeLimit($hLimit, $hSettings['limits_hidden'], $iKey); } } unset($hLimit); } unset($hLimitGroup); } } $data = array_merge($hSettings, array('entries' => $data, 'has' => array('limits' => $bHasLimits, 'limits_hidden' => $bHasHiddenLimits))); if ($bRetGroup) { $data['grouped_limits'] = array('groups' => $hAllLimitGroups, 'limits' => $hAllLimits); } } return $data; }