private function global_controller($filepath){ if(file_exists($filepath)){ include $filepath; $incname=ROUTE_C; if (class_exists($incname)) { return new $incname; } else{ _error('The "'.$incname.'" class does not exist.','...'); exit(); } }else{ _error('Module or Controller does not exist.','Please verify that the path is correct.'); exit(); } }
/** show error-message and terminate */ function show_error($error, $extra = NULL) { _error($error . " : " . $extra); // we do not know whether the language module was already loaded $errmsg = isset($GLOBALS["error_msg"]) ? $GLOBALS["error_msg"]["error"] : "ERROR"; $backmsg = isset($GLOBALS["error_msg"]) ? $GLOBALS["error_msg"]["back"] : "BACK"; show_header($errmsg); ?> <center> <h2><?php echo $errmsg; ?> </h2> <?php echo $error; ?> <h3> <a href="javascript:window.history.back()"><?php echo $backmsg; ?> </a><h3> <?php if ($extra != NULL) { echo " - " . $extra; } ?> </center> <?php show_footer(); exit; }
public function __construct($name, $read_cb = null) { $pipes_folder = JAXL_CWD . '/.jaxl/pipes'; if (!is_dir($pipes_folder)) { mkdir($pipes_folder); } $this->ev = new JAXLEvent(); $this->name = $name; $this->read_cb = $read_cb; $pipe_path = $this->get_pipe_file_path(); if (!file_exists($pipe_path)) { posix_mkfifo($pipe_path, $this->perm); $this->fd = fopen($pipe_path, 'r+'); if (!$this->fd) { _error("unable to open pipe"); } else { _debug("pipe opened using path {$pipe_path}"); _notice("Usage: \$ echo 'Hello World!' > {$pipe_path}"); $this->client = new JAXLSocketClient(); $this->client->connect($this->fd); $this->client->set_callback(array(&$this, 'on_data')); } } else { _error("pipe with name {$name} already exists"); } }
function _query($query, $step) { $result = mysql_query($query); if (!$result) { _error("Query failed : " . mysql_error(), $step); } else { return $result; } }
protected function tpl($module = 'admin', $template = 'index') { $file = G_SYSTEM . 'modules/' . $module . '/tpl/' . $template . '.tpl.php'; if (file_exists($file)) { return $file; } elseif (defined("G_IN_ADMIN")) { _message("没有找到<font color='red'>" . $module . "</font>模块下的<font color='red'>" . $template . ".tpl.php</font>文件!"); } else { _error('template message', 'The "' . $module . '.' . $template . '" template file does not exist'); } }
public function connect($ip, $port = 1080) { $this->ip = $ip; $this->port = $port; $sock_path = $this->_sock_path(); if ($this->client->connect($sock_path)) { _debug("established connection to {$sock_path}"); return true; } else { _error("unable to connect {$sock_path}"); return false; } }
function login() { if (isset($_SESSION["s_user"])) { if (!user_activate($_SESSION["s_user"], $_SESSION["s_pass"])) { _debug("Failed to activate user " . $_SESSION['s_user']); logout(); } } else { if (isset($_POST["p_pass"])) { $p_pass = $_POST["p_pass"]; } else { $p_pass = ""; } if (isset($_POST["p_user"])) { // Check Login if (!user_activate(stripslashes($_POST["p_user"]), md5(stripslashes($p_pass)))) { _error("failed to authenticate user " . $_POST["p_user"]); logout(); } // authentication sucessfull _debug("user '" . $_POST["p_user"] . "' successfully authenticated"); // set language $_SESSION['language'] = qx_request("lang", "en"); return; } else { // Ask for Login show_header($GLOBALS["messages"]["actlogin"]); echo "<CENTER><BR><TABLE width=\"300\"><TR><TD colspan=\"2\" class=\"header\" nowrap><B>"; echo $GLOBALS["messages"]["actloginheader"] . "</B></TD></TR>\n<FORM name=\"login\" action=\""; echo make_link("login", NULL, NULL) . "\" method=\"post\">\n"; echo "<TR><TD>" . $GLOBALS["messages"]["miscusername"] . ":</TD><TD align=\"right\">"; echo "<INPUT name=\"p_user\" type=\"text\" size=\"25\"></TD></TR>\n"; echo "<TR><TD>" . $GLOBALS["messages"]["miscpassword"] . ":</TD><TD align=\"right\">"; echo "<INPUT name=\"p_pass\" type=\"password\" size=\"25\"></TD></TR>\n"; //Select box and auto language detection array echo "<TR><TD>" . gettext("Detected Language:<br />(Change if needed)") . "</TD><TD align=\"right\">"; include './_lang/_info.php'; echo "<TR><TD colspan=\"2\" align=\"right\"><INPUT type=\"submit\" value=\""; echo $GLOBALS["messages"]["btnlogin"] . "\"></TD></TR>\n</FORM></TABLE><BR></CENTER>\n"; ?> <script language="JavaScript1.2" type="text/javascript"> <!-- if(document.login) document.login.p_user.focus(); // --> </script><?php show_footer(); exit; } } }
public function __construct($name, $perm = 0600) { $this->name = $name; $this->perm = $perm; $pipe_path = $this->get_pipe_file_path(); if (!file_exists($pipe_path)) { posix_mkfifo($pipe_path, $this->perm); $this->fd = fopen($pipe_path, 'r+'); if (!$this->fd) { _error("unable to open pipe"); } stream_set_blocking($this->fd, false); // watch for incoming data on pipe JAXLLoop::watch($this->fd, array('read' => array(&$this, 'on_read_ready'))); } else { _error("pipe with name {$name} already exists"); } }
function doPOST() { // FIXME This should be done at apache level probably... $this->allowFromKey(); // $p = $this->assertNotEmpty('p'); $action = $this->assertNotEmpty('action'); $graph = $this->assertNotEmpty('graph'); // $type = $this->assertNotEmpty('type'); if ($action == 'put') { $json = $this->assertNotEmpty('json'); $json = json_decode(base64_decode($json)); switch (json_last_error()) { case JSON_ERROR_DEPTH: $error = ' - Maximum stack depth exceeded'; break; case JSON_ERROR_CTRL_CHAR: $error = ' - Unexpected control character found'; break; case JSON_ERROR_SYNTAX: $error = ' - Syntax error, malformed JSON'; break; case JSON_ERROR_NONE: default: $error = ''; } if ($error) { _error('Broken JSON: ' . $error); } $ntriples = jsonld_normalize($json, array('format' => 'application/nquads')); $this->parameters['data'] = $ntriples; //put_ntriples($ntriples, $graph); //$output = $ntriples; //header("HTTP/1.1 " . 200, true, 200); return $this->_doPUT(); } else { if ($action == 'delete') { return $this->doDELETE(); } } // exit(0); // Die happy }
<?php if (isset($attributes['code'])) { if ($arrProperty = $oPropertyManager->getProperty($attributes['code'])) { _assign("arrProperty", $arrProperty); } else { _error("ENoPropertyFound", "No property found with this code"); } } else { _error("ENoPropertyGiven", "No property given to edit"); } _display("admin/dspPropertyForm.tpl");
<?php $arrLanguages = $oLanguageManager->getLanguages(); $arrImages = $ogGalleryManager->getImages($attributes['gallery']); $intLanguageID = $oLanguage->getID(); _assign("intLanguageID", $intLanguageID); _assign("arrImages", $arrImages); _assign("arrLanguages", $arrLanguages); if (!empty($attributes['gallery'])) { if ($ogGalleryManager->checkGallery($attributes['gallery'])) { _display("admin/dspGallery.tpl"); } else { _error("EGalleryNotExists", "Gallery not exists"); } } else { _error("EGalleryNotGiven", "Gallery not given"); }
<?php $tmpoGroup = new Group(); if (!empty($attributes['id'])) { if (!($tmpoGroup = $oSecurityManager->getGroupByID($attributes['id']))) { _error("ENoGroupFound", "No security group with ID={$attributes['id']} found"); } } if (isset($attributes['fCode'])) { $tmpoGroup->setCode($attributes['fCode']); } if (isset($attributes['fName'])) { $tmpoGroup->setName($attributes['fName']); } if (isset($attributes['fDescription'])) { $tmpoGroup->setDescription($attributes['fDescription']); } if (isset($attributes['fHomePage'])) { $tmpoGroup->setHomePage($attributes['fHomePage']); } _assign("tmpoGroup", $tmpoGroup); _display("admin/dspGroupForm.tpl");
<?php $galleryPath = $fusebox['pathGalleries'] . $attributes['gallery'] . "/"; $thumbsPath = $galleryPath . $fusebox['folderThumbs'] . "/"; if (!empty($attributes['gallery']) && !empty($attributes['image'])) { if ($strImageFileName = $ogGalleryManager->getImageFileName($attributes['gallery'], $attributes['image'])) { if ($ogGalleryManager->deleteImage($attributes['gallery'], $attributes['image'])) { if (file_exists($galleryPath . $strImageFileName)) { if (!unlink($galleryPath . $strImageFileName)) { _message("MGalleryImageFileRemained", "Gallery image file remained on disk"); } } if (file_exists($thumbsPath . $strImageFileName)) { if (!unlink($thumbsPath . $strImageFileName)) { _message("MGalleryThumbFileRemained", "Gallery image thumbnail file remained on disk"); } } $ogGalleryManager->setGalleryUpdatedDate($attributes['gallery']); _message("MGalleryImageDeleted", "Gallery image deleted"); } else { _warning("WGalleryImageNotDeleted", "Gallery image not deleted"); } } else { _warning("WGalleryImageNotFound", "Gallery image not found"); } } else { _error("EGalleryImageNotGiven", "Gallery image not given to delete"); }
/** * Upload cover image. * * @param Request $request * * @return AJAX */ function uploadCover(Request $request) { if ($request->isMethod('POST')) { $rules = $this->_getCoverRules(); $messages = $this->_getCoverMessages(); $validator = Validator::make($request->all(), $rules, $messages); if ($validator->fails()) { return file_pong(['messages' => $validator->errors()->first()], _error(), 403); } if ($request->file('__file')->isValid()) { $avatar = $request->file('__file'); $storagePath = config('frontend.coversFolder'); $mediumSizeW = (int) config('frontend.coverMediumW'); $mediumSizeH = (int) config('frontend.coverMediumH'); $mediumName = generate_filename($storagePath, $avatar->getClientOriginalExtension(), ['prefix' => 'cover_', 'suffix' => "_{$mediumSizeW}x{$mediumSizeH}"]); $avatar->move($storagePath, $mediumName); $image = ImageIntervention::make($storagePath . '/' . $mediumName)->orientate(); $image->fit($mediumSizeW, $mediumSizeH, function ($constraint) { $constraint->upsize(); }); $image->save(); $userProfile = user()->userProfile; if (is_null($userProfile)) { $userProfile = new UserProfile(); $userProfile->user_id = user()->id; } else { $avatarImg = unserialize($userProfile->cover_image); if (isset($avatarImg[$mediumSizeW])) { delete_file($storagePath . '/' . $avatarImg[$mediumSizeW]); } } $userProfile->cover_image = serialize(array($mediumSizeW => $mediumName)); $userProfile->save(); return file_pong(['cover_medium' => $storagePath . '/' . $mediumName]); } return file_pong(['messages' => _t('opps')], _error(), 403); } }
/** * @param string | resource $socket_path */ public function connect($socket_path) { if (gettype($socket_path) == "string") { $path_parts = explode(":", $socket_path); $this->transport = $path_parts[0]; $this->host = substr($path_parts[1], 2, strlen($path_parts[1])); if (sizeof($path_parts) == 3) { $this->port = $path_parts[2]; } _info("trying " . $socket_path); if ($this->stream_context) { $this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->stream_context); } else { $this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout); } } else { $this->fd =& $socket_path; } if ($this->fd) { _debug("connected to " . $socket_path . ""); stream_set_blocking($this->fd, $this->blocking); // watch descriptor for read/write events JAXLLoop::watch($this->fd, array('read' => array(&$this, 'on_read_ready'))); return true; } else { _error("unable to connect " . $socket_path . " with error no: " . $this->errno . ", error str: " . $this->errstr . ""); $this->disconnect(); return false; } }
$search_user_id = intval($row['user_id']); } } // word list $search_words = array(); if (!empty($words)) { $w_words = explode(',', $words); for ($i = 0; $i < count($w_words); $i++) { $word = trim($w_words[$i]); if (!empty($word)) { $search_words[] = $word; } } } if ($search_user_id == ANONYMOUS && empty($search_words)) { _error('Search_no_criteria'); } //----------------------------- // // main entry // //----------------------------- if ($pmmode == 'search') { if ($cancel) { $pmmode = ''; $pm_start = 0; $cancel = false; } else { if ($submit) { // send any error messages if ($error) {
<?php if (!empty($attributes['node'])) { if ($arrNode = $ogArticleTree->getNodeInfo($attributes['node'])) { $sql = "DELETE FROM " . $fusebox['tableArticles'] . " WHERE id_token = " . $arrNode['data_id']; if ($oDB->query($sql) && $ogArticleTree->removeNodes($attributes['node'])) { _message("MArticleRemoved", "Article removed"); } } else { _error("EArticleNodeNotExists", "Article node not exists"); } } else { _error("ENoArticleNodeGiven", "No article node given"); } _xfa($myself . "admin.showArticlesTree");
$targetArray = $_REQUEST; // Verifies the expected parameters $params = array(CLASS_PARAMETER, METHOD_PARAMETER); foreach ($params as $p) { if (!isset($targetArray["{$p}"])) { _error("Parameter '{$p}' not sent."); } } $className = htmlentities($targetArray[CLASS_PARAMETER], ENT_QUOTES, 'UTF-8'); $methodName = htmlentities($targetArray[METHOD_PARAMETER], ENT_QUOTES, 'UTF-8'); // Uses the __autoload to search for the class file and include it if (!class_exists($className, true)) { _error("Class '{$className}' not found."); } // Calls the defined method, get its result and send to the client try { // Verifies if the method exists in the class instance $obj = new $className(); if (!method_exists($obj, $methodName)) { _error("Method '{$methodName}' not found in class '{$className}'."); } $data = call_user_func(array($obj, $methodName)); if (isset($_REQUEST[RAW_PARAMETER])) { die(JSON::encode($data)); } else { die(JSON::encode(new Response(true, '', $data))); } } catch (Exception $e) { _error($e->getMessage(), get_class($e)); // Send the exception class as the "data" }
public function recv() { if ($this->restarted) { $this->restarted = false; // fool xmpp_stream state machine with stream start packet // and make transition to wait_for_stream_features state if ($this->recv_cb) { call_user_func($this->recv_cb, $this->jaxl->get_start_stream(new XMPPJid("bosh.jaxl"))); } } _debug("recving for {$this->rid}"); do { $ret = curl_multi_exec($this->mch, $running); $changed = curl_multi_select($this->mch, 0.1); if ($changed == 0 && $running == 0) { $ch = @$this->chs[$this->rid]; if ($ch) { $data = curl_multi_getcontent($ch); curl_multi_remove_handle($this->mch, $ch); unset($this->chs[$this->rid]); _debug("recvd for {$this->rid} " . $data); list($body, $stanza) = $this->unwrap($data); $body = new SimpleXMLElement($body); $attrs = $body->attributes(); if (@$attrs['type'] == 'terminate') { // fool me again if ($this->recv_cb) { call_user_func($this->recv_cb, $this->jaxl->get_end_stream()); } } else { if (!$this->sid) { $this->sid = $attrs['sid']; } if ($this->recv_cb) { call_user_func($this->recv_cb, $stanza); } } } else { _error("no ch found"); exit; } } } while ($running); }
public function handle_auth_mechs($stanza, $mechanisms) { if ($this->ev->exists('on_stream_features')) { return $this->ev->emit('on_stream_features', array($stanza)); } // extract available mechanisms $mechs = array(); if ($mechanisms) { foreach ($mechanisms->childrens as $mechanism) { $mechs[$mechanism->text] = true; } } // check if preferred auth type exists in available mechanisms $pref_auth = @$this->cfg['auth_type'] ? $this->cfg['auth_type'] : 'PLAIN'; $pref_auth_exists = isset($mechs[$pref_auth]) ? true : false; _debug("pref_auth " . $pref_auth . " " . ($pref_auth_exists ? "exists" : "doesn't exists")); // if pref auth exists, try it if ($pref_auth_exists) { $mech = $pref_auth; } else { foreach ($mechs as $mech => $any) { // choose X-FACEBOOK-PLATFORM only if fb_access_token config value is available if ($mech == 'X-FACEBOOK-PLATFORM') { if (@$this->cfg['fb_access_token']) { break; } } else { break; } } _error("preferred auth type not supported, trying {$mech}"); } $this->send_auth_pkt($mech, @$this->jid ? $this->jid->to_string() : null, @$this->pass); if ($pref_auth == 'X-FACEBOOK-PLATFORM') { return "wait_for_fb_sasl_response"; } else { if ($pref_auth == 'CRAM-MD5') { return "wait_for_cram_md5_response"; } else { if ($pref_auth == 'SCRAM-SHA-1') { return "wait_for_scram_sha1_response"; } } } }
die(); } if ($_FILES["file"]["error"] > 0) _error ("Error: " . $_FILES["file"]["error"]); $ext = ""; if ($_FILES["file"]["type"] == "image/gif") $ext = $aTBGExtensions[0]; elseif ($_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/pjpeg") $ext = $aTBGExtensions[1]; elseif ($_FILES["file"]["type"] == "image/png") $ext = $aTBGExtensions[2]; if (!$ext) _error ("Error: not a JPEG, PNG or GIF image (".$_FILES["file"]["type"].")"); $size = $_FILES["file"]["size"] / 1024; if ($size > MAX_FILE_SIZE) _error ("Error: file size exceeds ".MAX_FILE_SIZE." Kb"); // if ($error = uploadTemplateBackground($_FILES["file"]["tmp_name"], $ext)) _error($error); else if (!$IE) die("OK"); else { ?> <script> opener.location.reload(); window.close(); </script> <? } ?> </BODY>
function __error($msg) { _error($msg); echo $msg; }
<?php if (!empty($attributes['fCode']) && isset($attributes['fName'])) { if (!$oPropertyManager->setProperty($attributes['fCode'], array('code' => $attributes['fCode'], 'name' => $attributes['fName']))) { _warning("WPropertyNotSaved", "Something happened when storing property, probably property with such code already exists"); } else { _message("MPropertySaved", "Property was sucessfully saved"); } } else { _error("EWrongFormSubmitted", "Wrong form submitted, or else..."); } _xfa($myself . "admin.showProperties");
function cli_processPlaylist($folder, $info) { $nextPageToken = null; $items = array(); do { $data = tubeAPI::getInstance()->playlistItems($info['id'], $nextPageToken); if (!empty($data->nextPageToken)) { $nextPageToken = $data->nextPageToken; } $items = array_merge($items, $data->items); } while (!empty($data->nextPageToken)); if (!empty($info['filter'])) { _echo(' Using title filter: `' . $info['filter'] . '`'); foreach ($items as $i => $item) { if (false === strstr($item->snippet->title, $info['filter'])) { unset($items[$i]); } } } $items = array_values($items); _echo(' ' . count($items) . ' items found'); $itemsInFolder = 0; $itemsDownloaded = 0; foreach ($items as $item) { if (!empty($info['inRegex']) && !empty($info['outRegex'])) { $fileName = preg_replace(chr(1) . $info['inRegex'] . chr(1), $info['outRegex'], $item->snippet->title) . '.mp4'; } else { $fileName = $item->snippet->title . '.mp4'; } $fileName = preg_replace('"\\s+"', ' ', $fileName); if (file_exists($folder . '/' . $fileName)) { // _echo( ' File `' . $fileName . '` exists' ); $itemsInFolder++; continue; } else { ini_set('set_time_limit', '0'); $vUrl = 'http://www.youtube.com/watch?v=' . $item->snippet->resourceId->videoId; _echo(' Downloading file `' . $fileName . '` from `' . $vUrl . '`...'); _echo(' > youtube-dl -f 22 -o "%(title)s.%(ext)s" "' . $item->snippet->resourceId->videoId . '"'); $downFileName = exec('youtube-dl -f 22 --get-filename -o "%(title)s.%(ext)s" "' . $item->snippet->resourceId->videoId . '"', $null, $ret); exec('youtube-dl -f 22 -o "' . $folder . '/%(title)s.%(ext)s" ' . $item->snippet->resourceId->videoId, $null, $ret); if (!empty($info['inRegex']) && !empty($info['outRegex']) && $downFileName != $fileName) { if (!rename($folder . '/' . $downFileName, $folder . '/' . $fileName)) { _error('Unable to rename file'); _error(' >"' . $folder . '/' . $downFileName . '"' . (file_exists($folder . '/' . $downFileName) ? ' [exists]' : ' [NOT exists]'), false); _error(' <"' . $folder . '/' . $fileName . '"' . (file_exists($folder . '/' . $fileName) ? ' [EXISTS]' : ' [not exists]'), true); } } _echo(' Done'); $itemsDownloaded++; } } if ($itemsInFolder == count($items)) { _echo(' Playlist is up to date. Nothing to download.'); } else { if (!empty($itemsDownloaded)) { _echo(' ' . $itemsDownloaded . ' files downloaded.'); } } }
<?php if (isset($attributes['fuseactionid']) && is_numeric($attributes['fuseactionid'])) { if (!empty($attributes['token'])) { $arrLanguages = $oLanguageManager->getLanguages(); foreach ($arrLanguages as $l) { $tmpFormFieldName = 'content_' . $l->getID(); if (isset($attributes[$tmpFormFieldName])) { $strContent = html_entity_decode($attributes[$tmpFormFieldName], ENT_COMPAT, $l->getEncoding()); if ($strContent !== false) { if (!$oSEOContentManager->pushContent($attributes['fuseactionid'], $l->getID(), $attributes['token'], $strContent)) { _warning("WSEOContentNotStored", "Something happened while storing SEO content"); } } else { _warning("WSEOContentCannotBeConverted", "SEO content cannot be converted to " . $l->getEncoding()); } } } } else { _error("ENoSEOTokenGiven", "No SEO token is given"); } } else { _error("ENoFuseactionGiven", "No page is given"); } _xfa($myself . "admin.showFuseactionSEOTokens&id=" . $attributes['fuseactionid']);
/** * Returns one item (Nucleus version) */ function _getItem($itemid, $username, $password) { global $manager; // 1. login $mem = new MEMBER(); if (!$mem->login($username, $password)) { return _error(1, "Could not log in"); } // 2. check if allowed if (!$manager->existsItem($itemid, 1, 1)) { return _error(6, "No such item ({$itemid})"); } $blogid = getBlogIDFromItemID($itemid); if (!$mem->teamRights($blogid)) { return _error(3, "Not a team member"); } // 3. return the item // Structure returned has dateCreated, userid, blogid and content $item =& $manager->getItem($itemid, 1, 1); // (also allow drafts and future items) $blog = new BLOG($blogid); if ($blog->convertBreaks()) { $item['body'] = removeBreaks($item['body']); } $newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($item['title'], "string"), "body" => new xmlrpcval($item['body'], "string"), "more" => new xmlrpcval($item['more'], "string"), "draft" => new xmlrpcval($item['draft'], "boolean"), "closed" => new xmlrpcval($item['closed'], "boolean")), 'struct'); return new xmlrpcresp($newstruct); }
<? if(isset($imageFileName)){ _assign("imageFileName", $imageFileName); }else{ _error("ENoImageFileName", "No image file name given"); } _display("util/dspUploadContentResult.tpl"); ?>
public function handle_invalid_state($r) { _error("got invalid return value from state handler '" . $this->state . "', sending end stream..."); $this->send_end_stream(); $this->state = "logged_out"; _notice("state handler '" . $this->state . "' returned " . serialize($r) . ", kindly report this to developers"); }
<?php if (isset($attributes['fCode']) && isset($attributes['fXCode']) && isset($attributes['fName']) && isset($attributes['fPos'])) { if (strlen($attributes['fCode']) > 0) { if (isset($attributes['entryid'])) { if (!$oPropertyManager->setDictionaryEntryByID($attributes['entryid'], array('code' => $attributes['fCode'], 'xcode' => $attributes['fXCode'], 'name' => $attributes['fName'], 'pos' => $attributes['fPos']))) { _warning("WPropertyDictionaryEntryNotStored", "Something happened while saving property dictionary entry to DB, probably another entry exists with same code or no entry with such ID (already) exists"); } else { _message("MPropertyDictionaryEntryStored", "Property dictionary entry successfully stored"); } } elseif (isset($attributes['propertycode'])) { if (!$oPropertyManager->addDictionaryEntry($attributes['propertycode'], array('code' => $attributes['fCode'], 'xcode' => $attributes['fXCode'], 'name' => $attributes['fName'], 'pos' => $attributes['fPos']))) { _warning("WPropertyDictionaryEntryNotAdded", "Something happened while adding property dictionary entry to DB, probably entry with such code already exists"); } else { _message("MPropertyDictionaryEntryAdded", "Property dictionary entry successfully added"); } } else { _error("ENoPropertyOrEntryFound", "No property or dictionary entry given"); } } else { _warning("WPropertyDictionaryEntryCodeCannotBeEmpty", "Property dictionary entry code cannot be empty"); } } else { _error("EWrongEntryFormSubmitted", "Invalid property dictionary form submitted"); } _xfa($myself . "admin.showPropertyDictionary&code=" . $attributes['propertycode']);
} else { _warning("WCannotUploadContentFile", "Cannot upload content file "); } } } if (!_gotErrors() && !_gotWarnings()) { if (empty($attributes['image'])) { /* * add new image */ if ($ogGalleryManager->addImage($attributes['gallery'], $attributes['newimage'], $oImage->getFileName())) { $ogGalleryManager->setGalleryUpdatedDate($attributes['gallery']); _message("MGalleryImageAdded", "Gallery image added"); $attributes['image'] = $attributes['newimage']; } else { _error("EImageExists", "Image already exists or I cannot add it..."); } } else { /* * update existed image */ if (!empty($oImage)) { if (!$ogGalleryManager->setImageFileName($attributes['gallery'], $attributes['image'], $oImage->getFileName())) { _warning("WGalleryImageNotStored", "Something happened while storing graphics"); } } if (!empty($attributes['newimage'])) { $attributes['newimage'] = preg_replace("/[^a-zA-Z0-9\\_\\.]/", "_", $attributes['newimage']); if ($ogGalleryManager->setImageToken($attributes['gallery'], $attributes['image'], $attributes['newimage'])) { $attributes['image'] = $attributes['newimage']; } else {