mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 00:05:23 +02:00
Version 15.126.1
This commit is contained in:
parent
639b622d6b
commit
5ad6d494aa
|
@ -205,7 +205,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
||||||
/* Write full content of the notice */
|
/* Write full content of the notice */
|
||||||
strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
||||||
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
||||||
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,40);
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,40);
|
||||||
fprintf (FileRSS,"<description><![CDATA[<p><em>%s %s %s:</em></p><p>%s</p>]]></description>\n",
|
fprintf (FileRSS,"<description><![CDATA[<p><em>%s %s %s:</em></p><p>%s</p>]]></description>\n",
|
||||||
UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2,Content);
|
UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2,Content);
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ void Ann_ShowAllAnnouncements (void)
|
||||||
/* Get the content (row[4]) and insert links */
|
/* Get the content (row[4]) and insert links */
|
||||||
strncpy (Content,row[4],Cns_MAX_BYTES_TEXT);
|
strncpy (Content,row[4],Cns_MAX_BYTES_TEXT);
|
||||||
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
||||||
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50);
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||||
|
|
||||||
/* Show the announcement */
|
/* Show the announcement */
|
||||||
Ann_DrawAnAnnouncement (AnnCod,Status,Subject,Content,
|
Ann_DrawAnAnnouncement (AnnCod,Status,Subject,Content,
|
||||||
|
@ -220,7 +220,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
|
||||||
/* Get the content (row[2]) and insert links */
|
/* Get the content (row[2]) and insert links */
|
||||||
strncpy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
strncpy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
||||||
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
Content[Cns_MAX_BYTES_TEXT] = '\0';
|
||||||
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50);
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||||
|
|
||||||
/* Show the announcement */
|
/* Show the announcement */
|
||||||
Ann_DrawAnAnnouncement (AnnCod,Ann_ACTIVE_ANNOUNCEMENT,Subject,Content,
|
Ann_DrawAnAnnouncement (AnnCod,Ann_ACTIVE_ANNOUNCEMENT,Subject,Content,
|
||||||
|
|
|
@ -328,7 +328,7 @@ static void Asg_ShowOneAssignment (long AsgCod)
|
||||||
Asg_GetAssignmentTxtFromDB (Asg.AsgCod,Txt);
|
Asg_GetAssignmentTxtFromDB (Asg.AsgCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">",
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">",
|
||||||
Gbl.RowEvenOdd);
|
Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
|
||||||
Att_GetAttEventTxtFromDB (Att->AttCod,Txt);
|
Att_GetAttEventTxtFromDB (Att->AttCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LEFT_TOP COLOR%u\">",
|
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LEFT_TOP COLOR%u\">",
|
||||||
Gbl.RowEvenOdd);
|
Gbl.RowEvenOdd);
|
||||||
|
|
||||||
|
|
|
@ -127,13 +127,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.126 (2016-01-24)"
|
#define Log_PLATFORM_VERSION "SWAD 15.126.1 (2016-01-24)"
|
||||||
#define CSS_FILE "swad15.121.7.css"
|
#define CSS_FILE "swad15.121.7.css"
|
||||||
#define JS_FILE "swad15.121.7.js"
|
#define JS_FILE "swad15.121.7.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.126.1: Jan 24, 2016 Optimization in code to insert links. (194736 lines)
|
||||||
Version 15.126: Jan 24, 2016 In any text where URL is replaced by anchor, now @nickname is also replaced to link to user's profile. (194727 lines)
|
Version 15.126: Jan 24, 2016 In any text where URL is replaced by anchor, now @nickname is also replaced to link to user's profile. (194727 lines)
|
||||||
2 changes necessary in database:
|
2 changes necessary in database:
|
||||||
UPDATE social_posts SET Content=REPLACE(Content,'@','@');
|
UPDATE social_posts SET Content=REPLACE(Content,'@','@');
|
||||||
|
|
|
@ -1589,7 +1589,7 @@ static void Inf_ShowPlainTxtInfo (Inf_InfoType_t InfoType)
|
||||||
/***** Convert to respectful HTML and insert links *****/
|
/***** Convert to respectful HTML and insert links *****/
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
Str_InsertLinks (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||||
|
|
||||||
/***** Write text *****/
|
/***** Write text *****/
|
||||||
fprintf (Gbl.F.Out,"%s",TxtHTML);
|
fprintf (Gbl.F.Out,"%s",TxtHTML);
|
||||||
|
@ -1757,7 +1757,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
|
||||||
/* Convert to respectful HTML and insert links */
|
/* Convert to respectful HTML and insert links */
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
Str_InsertLinks (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||||
|
|
||||||
/* Write text */
|
/* Write text */
|
||||||
fprintf (FileHTMLTmp,"%s",TxtHTML);
|
fprintf (FileHTMLTmp,"%s",TxtHTML);
|
||||||
|
|
|
@ -3392,7 +3392,7 @@ void Msg_WriteMsgContent (char *Content,unsigned long MaxLength,bool InsertLinks
|
||||||
{
|
{
|
||||||
/***** Insert links in URLs *****/
|
/***** Insert links in URLs *****/
|
||||||
if (InsertLinks)
|
if (InsertLinks)
|
||||||
Str_InsertLinkInURLs (Content,MaxLength,60);
|
Str_InsertLinks (Content,MaxLength,60);
|
||||||
|
|
||||||
/***** Write message to file *****/
|
/***** Write message to file *****/
|
||||||
if (ChangeBRToRet)
|
if (ChangeBRToRet)
|
||||||
|
|
|
@ -449,7 +449,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices)
|
||||||
|
|
||||||
/* Get the content (row[3]) and insert links */
|
/* Get the content (row[3]) and insert links */
|
||||||
strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
||||||
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,
|
||||||
Not_MaxCharsURLOnScreen[TypeNoticesListing]);
|
Not_MaxCharsURLOnScreen[TypeNoticesListing]);
|
||||||
if (TypeNoticesListing == Not_LIST_BRIEF_NOTICES)
|
if (TypeNoticesListing == Not_LIST_BRIEF_NOTICES)
|
||||||
Str_LimitLengthHTMLStr (Content,Not_MAX_CHARS_ON_NOTICE);
|
Str_LimitLengthHTMLStr (Content,Not_MAX_CHARS_ON_NOTICE);
|
||||||
|
@ -514,7 +514,7 @@ static void Not_GetDataAndShowNotice (long NotCod,bool ICanEditNotices)
|
||||||
|
|
||||||
/* Get the content (row[2]) and insert links*/
|
/* Get the content (row[2]) and insert links*/
|
||||||
strncpy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
strncpy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
||||||
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,
|
||||||
Not_MaxCharsURLOnScreen[Not_LIST_FULL_NOTICES]);
|
Not_MaxCharsURLOnScreen[Not_LIST_FULL_NOTICES]);
|
||||||
|
|
||||||
/* Get status of the notice (row[3]) */
|
/* Get status of the notice (row[3]) */
|
||||||
|
|
|
@ -76,7 +76,7 @@ static const char Str_CR[2] = {13,0};
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* Insert links in URLs ******************************/
|
/****************** Insert a link in every URL or nickname *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
Insertion example:
|
Insertion example:
|
||||||
|
@ -91,20 +91,20 @@ The web site of <a href="https://openswad.org/?usr=@rms">@rms</a> is <a href="ht
|
||||||
|
|
||||||
#define MAX_BYTES_LIMITED_URL 1024 // Max. number of bytes of the URL shown on screen
|
#define MAX_BYTES_LIMITED_URL 1024 // Max. number of bytes of the URL shown on screen
|
||||||
|
|
||||||
void Str_InsertLinkInURLs (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen)
|
void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen)
|
||||||
{
|
{
|
||||||
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES];
|
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES];
|
||||||
char ANCHOR_1_NICK[256+Ses_LENGTH_SESSION_ID];
|
char ANCHOR_1_NICK[256+Ses_LENGTH_SESSION_ID];
|
||||||
char ANCHOR_2_NICK[128];
|
char ANCHOR_2_NICK[128];
|
||||||
unsigned long TxtLength;
|
size_t TxtLength;
|
||||||
unsigned long TxtLengthWithInsertedAnchors;
|
size_t TxtLengthWithInsertedAnchors;
|
||||||
unsigned Anchor1URLLength;
|
size_t Anchor1URLLength;
|
||||||
unsigned Anchor1NickLength;
|
size_t Anchor1NickLength;
|
||||||
unsigned Anchor2URLLength;
|
size_t Anchor2URLLength;
|
||||||
unsigned Anchor2NickLength;
|
size_t Anchor2NickLength;
|
||||||
unsigned Anchor3Length;
|
size_t Anchor3Length;
|
||||||
unsigned AnchorURLTotalLength;
|
size_t AnchorURLTotalLength;
|
||||||
unsigned AnchorNickTotalLength;
|
size_t AnchorNickTotalLength;
|
||||||
char *PtrSrc;
|
char *PtrSrc;
|
||||||
char *PtrDst;
|
char *PtrDst;
|
||||||
bool URLStartFound;
|
bool URLStartFound;
|
||||||
|
@ -154,7 +154,7 @@ void Str_InsertLinkInURLs (char *Txt,unsigned long MaxLength,size_t MaxCharsURLO
|
||||||
AnchorURLTotalLength = Anchor1URLLength + Anchor2URLLength + Anchor3Length;
|
AnchorURLTotalLength = Anchor1URLLength + Anchor2URLLength + Anchor3Length;
|
||||||
AnchorNickTotalLength = Anchor1NickLength + Anchor2NickLength + Anchor3Length;
|
AnchorNickTotalLength = Anchor1NickLength + Anchor2NickLength + Anchor3Length;
|
||||||
|
|
||||||
/***** Find starts and ends of URLs *****/
|
/***** Find starts and ends of links (URLs and nicknames) *****/
|
||||||
for (PtrSrc = Txt;
|
for (PtrSrc = Txt;
|
||||||
*PtrSrc;)
|
*PtrSrc;)
|
||||||
/* Check if the next char is the start of a URL */
|
/* Check if the next char is the start of a URL */
|
||||||
|
@ -349,15 +349,19 @@ void Str_InsertLinkInURLs (char *Txt,unsigned long MaxLength,size_t MaxCharsURLO
|
||||||
|
|
||||||
/* Step 4: Insert ANCHOR_2_LINK or ANCHOR_2_URL */
|
/* Step 4: Insert ANCHOR_2_LINK or ANCHOR_2_URL */
|
||||||
if (IsNickname)
|
if (IsNickname)
|
||||||
for (i = 0, PtrSrc = ANCHOR_2_NICK + Anchor2NickLength - 1;
|
{
|
||||||
i < Anchor2NickLength;
|
PtrSrc = ANCHOR_2_NICK + Anchor2NickLength - 1;
|
||||||
i++)
|
Length = Anchor2NickLength;
|
||||||
*PtrDst-- = *PtrSrc--;
|
}
|
||||||
else
|
else
|
||||||
for (i = 0, PtrSrc = ANCHOR_2_URL + Anchor2URLLength - 1;
|
{
|
||||||
i < Anchor2URLLength;
|
PtrSrc = ANCHOR_2_URL + Anchor2URLLength - 1;
|
||||||
i++)
|
Length = Anchor2URLLength;
|
||||||
*PtrDst-- = *PtrSrc--;
|
}
|
||||||
|
for (i = 0;
|
||||||
|
i < Length;
|
||||||
|
i++)
|
||||||
|
*PtrDst-- = *PtrSrc--;
|
||||||
|
|
||||||
/* Step 5: Insert link into directive A
|
/* Step 5: Insert link into directive A
|
||||||
(it's mandatory to do the copy in reverse order
|
(it's mandatory to do the copy in reverse order
|
||||||
|
@ -369,15 +373,19 @@ void Str_InsertLinkInURLs (char *Txt,unsigned long MaxLength,size_t MaxCharsURLO
|
||||||
|
|
||||||
/* Step 6: Insert ANCHOR_1_NICK or ANCHOR_1_URL */
|
/* Step 6: Insert ANCHOR_1_NICK or ANCHOR_1_URL */
|
||||||
if (IsNickname)
|
if (IsNickname)
|
||||||
for (i = 0, PtrSrc = ANCHOR_1_NICK + Anchor1NickLength - 1;
|
{
|
||||||
i < Anchor1NickLength;
|
PtrSrc = ANCHOR_1_NICK + Anchor1NickLength - 1;
|
||||||
i++)
|
Length = Anchor1NickLength;
|
||||||
*PtrDst-- = *PtrSrc--;
|
}
|
||||||
else
|
else
|
||||||
for (i = 0, PtrSrc = ANCHOR_1_URL + Anchor1URLLength - 1;
|
{
|
||||||
i < Anchor1URLLength;
|
PtrSrc = ANCHOR_1_URL + Anchor1URLLength - 1;
|
||||||
i++)
|
Length = Anchor1URLLength;
|
||||||
*PtrDst-- = *PtrSrc--;
|
}
|
||||||
|
for (i = 0;
|
||||||
|
i < Length;
|
||||||
|
i++)
|
||||||
|
*PtrDst-- = *PtrSrc--;
|
||||||
|
|
||||||
LinksTotalLength -= NumBytesToShow;
|
LinksTotalLength -= NumBytesToShow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ typedef enum
|
||||||
/***************************** Public prototypes ****************************/
|
/***************************** Public prototypes ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Str_InsertLinkInURLs (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen);
|
void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen);
|
||||||
size_t Str_LimitLengthHTMLStr (char *Str,size_t MaxCharsOnScreen);
|
size_t Str_LimitLengthHTMLStr (char *Str,size_t MaxCharsOnScreen);
|
||||||
// bool Str_URLLooksValid (const char *URL);
|
// bool Str_URLLooksValid (const char *URL);
|
||||||
void Str_ConvertToTitleType (char *Str);
|
void Str_ConvertToTitleType (char *Str);
|
||||||
|
|
|
@ -483,7 +483,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh
|
||||||
Svy_GetSurveyTxtFromDB (Svy.SvyCod,Txt);
|
Svy_GetSurveyTxtFromDB (Svy.SvyCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
fprintf (Gbl.F.Out,"<p class=\"%s\">"
|
fprintf (Gbl.F.Out,"<p class=\"%s\">"
|
||||||
"%s"
|
"%s"
|
||||||
"</p>"
|
"</p>"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user